From 490e05ea13c6ac06a855bb9dad9f8bc0930e57bc Mon Sep 17 00:00:00 2001 From: shirely16 Date: Wed, 17 Mar 2021 16:31:25 +0800 Subject: [PATCH] Synchronizing the submission of other branches to the LTS branch --- ...08_fallback_counting.in-apply-grubby.patch | 61 +++++++++++++++ ...lock-counter-to-prevent-timeouts-wit.patch | 51 ++++++++++++ grub.patches | 2 + grub2.spec | 77 ++++++++++++++++--- 4 files changed, 182 insertions(+), 9 deletions(-) create mode 100644 0249-remove-08_fallback_counting.in-apply-grubby.patch create mode 100644 0250-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch diff --git a/0249-remove-08_fallback_counting.in-apply-grubby.patch b/0249-remove-08_fallback_counting.in-apply-grubby.patch new file mode 100644 index 0000000..48ea19c --- /dev/null +++ b/0249-remove-08_fallback_counting.in-apply-grubby.patch @@ -0,0 +1,61 @@ +From f09f144a2f04bd2775367a0df0a2e7900d96d6a1 Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Tue, 1 Sep 2020 16:59:53 +0800 +Subject: [PATCH] remove 08_fallback_counting.in apply grubby + +--- + Makefile.util.def | 6 ------ + util/grub.d/08_fallback_counting.in | 24 ------------------------ + 2 files changed, 30 deletions(-) + delete mode 100644 util/grub.d/08_fallback_counting.in + +diff --git a/Makefile.util.def b/Makefile.util.def +index f3a6996..3473947 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -458,12 +458,6 @@ script = { + }; + + script = { +- name = '08_fallback_counting'; +- common = util/grub.d/08_fallback_counting.in; +- installdir = grubconf; +-}; +- +-script = { + name = '12_menu_auto_hide'; + common = util/grub.d/12_menu_auto_hide.in; + installdir = grubconf; +diff --git a/util/grub.d/08_fallback_counting.in b/util/grub.d/08_fallback_counting.in +deleted file mode 100644 +index 2e2c3ff..0000000 +--- a/util/grub.d/08_fallback_counting.in ++++ /dev/null +@@ -1,24 +0,0 @@ +-#! /bin/sh -e +-# Fallback Countdown +-# +-# This snippet depends on 10_reset_boot_success and needs to be kept in sync. +-# +-# The boot_counter env var can be used to count down boot attempts after an +-# OSTree upgrade and choose the rollback deployment when 0 is reached. +-# Both boot_counter=X and boot_success=1 need to be set from userspace. +-cat << EOF +-insmod increment +-# Check if boot_counter exists and boot_success=0 to activate this behaviour. +-if [ -n "\${boot_counter}" -a "\${boot_success}" = "0" ]; then +- # if countdown has ended, choose to boot rollback deployment, +- # i.e. default=1 on OSTree-based systems. +- if [ "\${boot_counter}" = "0" -o "\${boot_counter}" = "-1" ]; then +- set default=1 +- set boot_counter=-1 +- # otherwise decrement boot_counter +- else +- decrement boot_counter +- fi +- save_env boot_counter +-fi +-EOF +-- +1.8.3.1 + diff --git a/0250-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch b/0250-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch new file mode 100644 index 0000000..e7b5c6e --- /dev/null +++ b/0250-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 e6cdc00..43501a6 100644 --- a/grub.patches +++ b/grub.patches @@ -246,3 +246,5 @@ Patch0245: 0245-efi-Fix-use-after-free-in-halt-reboot-path.patch Patch0246: 0246-loader-linux-Avoid-overflow-on-initrd-size-calculati.patch Patch0247: 0247-linux-Fix-integer-overflows-in-initrd-size-handling.patch Patch0248: 0248-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0249: 0249-remove-08_fallback_counting.in-apply-grubby.patch +Patch0250: 0250-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch diff --git a/grub2.spec b/grub2.spec index 681ed53..5f92001 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 8 +Release: 9 Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -72,12 +72,28 @@ Requires: grub2-common = %{epoch}:%{version}-%{release} Requires: gettext os-prober which file Requires(pre): dracut Requires(post): dracut -Provides: grub2-tools-minimal grub2-tools-extra -Obsoletes: grub2-tools-minimal grub2-tools-extra %description tools tools package for grub2. +%package tools-minimal +Summary: Support tools for GRUB. +Requires: gettext %{name}-common = %{epoch}:%{version}-%{release} +Obsoletes: grub2-tools < %{evr} + +%description tools-minimal +Support tools for GRUB. + +%package tools-extra +Summary: Support tools for GRUB. +Requires: gettext os-prober which file +Requires: %{name}-tools-minimal = %{epoch}:%{version}-%{release} +Requires: %{name}-common = %{epoch}:%{version}-%{release} +Obsoletes: grub2-tools < %{evr} + +%description tools-extra +Support tools for GRUB. + %ifarch x86_64 %package tools-efi Summary: efi packages for grub2-tools @@ -327,17 +343,26 @@ rm -r /boot/grub2.tmp/ || : %files tools %defattr(-,root,root) -%{_sbindir}/grub2-* +%{_sbindir}/%{name}-mkconfig %exclude %{_sbindir}/grub2-set-bootflag -%attr(4755, root, root) %{_sbindir}/grub2-set-bootflag -%{_bindir}/grub2-* -%exclude %{_sbindir}/%{name}-macbless -%exclude %{_bindir}/%{name}-render-label +%{_sbindir}/%{name}-switch-to-blscfg +%{_sbindir}/%{name}-rpm-sort +%{_sbindir}/%{name}-reboot +%{_sbindir}/%{name}-install +%{_sbindir}/%{name}-sparc64-setup +%{_sbindir}/%{name}-ofpathname +%{_sbindir}/%{name}-probe +%{_bindir}/%{name}-glue-efi +%{_bindir}/%{name}-file +%{_bindir}/%{name}-menulst2cfg +%{_bindir}/%{name}-mkimage +%{_bindir}/%{name}-mkrelpath +%{_bindir}/%{name}-script-check + %config %{_sysconfdir}/grub.d/??_* %exclude %{_sysconfdir}/grub.d/01_fallback_counting %attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/default/grub %{_sysconfdir}/grub.d/README -%{_sysconfdir}/sysconfig/grub %{_sysconfdir}/prelink.conf.d/grub2.conf %{_userunitdir}/* %{_unitdir}/* @@ -349,14 +374,41 @@ rm -r /boot/grub2.tmp/ || : %if %{with_legacy_arch} %{_sbindir}/grub2-install +%ifarch x86_64 +%{_sbindir}/%{name}-bios-setup +%else +%exclude %{_sbindir}/%{name}-bios-setup +%endif %ifarch %{sparc} %{_sbindir}/grub2-sparc64-setup +%{_sbindir}/%{name}-ofpathname %else %exclude %{_sbindir}/grub2-sparc64-setup +%exclude %{_sbindir}/%{name}-ofpathname %endif %exclude %{_sbindir}/grub2-ofpathname %endif +%files tools-minimal +%defattr(-,root,root) +%{_sysconfdir}/prelink.conf.d/grub2.conf +%attr(4755, root, root) %{_sbindir}/%{name}-set-bootflag +%{_sbindir}/%{name}-get-kernel-settings +%{_sbindir}/%{name}-set*password +%{_sbindir}/%{name}-set-default +%{_bindir}/%{name}-editenv +%{_bindir}/%{name}-mkpasswd-pbkdf2 + +%files tools-extra +%defattr(-,root,root) +%{_sysconfdir}/sysconfig/grub +%{_bindir}/%{name}-fstest +%{_bindir}/%{name}-kbdcomp +%{_bindir}/%{name}-mkfont +%{_bindir}/%{name}-mklayout +%{_bindir}/%{name}-mknetdir +%{_bindir}/%{name}-mkstandalone +%{_bindir}/%{name}-syslinux2cfg %ifnarch %{sparc} %{_bindir}/grub2-mkrescue %endif @@ -393,6 +445,13 @@ rm -r /boot/grub2.tmp/ || : %{_datadir}/man/man* %changelog +* Sat Feb 27 2021 fengtao - 2.04-9 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:tftp roll over block counter to prevent timeouts with + data packets + * Mon Feb 22 2021 zhangqiumiao - 2.04-8 - Type:bugfix - ID:NA -- Gitee