diff --git a/SOURCES/0465-10_linux.in-escape-kernel-option-characters-properly.patch b/SOURCES/0465-10_linux.in-escape-kernel-option-characters-properly.patch new file mode 100644 index 0000000..1937cb9 --- /dev/null +++ b/SOURCES/0465-10_linux.in-escape-kernel-option-characters-properly.patch @@ -0,0 +1,45 @@ +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 | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index fafdfbc4d3..4276d5e240 100755 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -180,6 +180,7 @@ update_bls_cmdline() + 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/SOURCES/0466-blscfg-check-if-variable-is-escaped-before-consideri.patch b/SOURCES/0466-blscfg-check-if-variable-is-escaped-before-consideri.patch new file mode 100644 index 0000000..fba6906 --- /dev/null +++ b/SOURCES/0466-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/SOURCES/grub.patches b/SOURCES/grub.patches index 46fde57..e365919 100644 --- a/SOURCES/grub.patches +++ b/SOURCES/grub.patches @@ -461,3 +461,5 @@ Patch0461: 0461-fs-xfs-Fix-XFS-directory-extent-parsing.patch Patch0462: 0462-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch Patch0463: 0463-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch Patch0464: 0464-fs-xfs-fix-large-extent-counters-incompat-feature-su.patch +Patch0465: 0465-10_linux.in-escape-kernel-option-characters-properly.patch +Patch0466: 0466-blscfg-check-if-variable-is-escaped-before-consideri.patch diff --git a/SPECS/grub2.spec b/SPECS/grub2.spec index 5524f15..445220f 100644 --- a/SPECS/grub2.spec +++ b/SPECS/grub2.spec @@ -16,7 +16,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 104%{?dist}.alma.1 +Release: 105%{?dist}.alma.1 Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -538,27 +538,42 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog -* Tue May 13 2025 Eduard Abdullin - 1:2.06-104.alma.1 +* Mon Nov 03 2025 Eduard Abdullin - 1:2.06-105.alma.1 - Debrand for AlmaLinux -* Thu Apr 3 2025 Nicolas Frayer 2.06-104 +* Wed Sep 03 2025 Leo Sandoval 2.06-105 +- Handle special kernel parameter characters properly +- Resolves: #RHEL-111748 + +* Fri Apr 4 2025 Nicolas Frayer 2.06-104 +- Bump NVR to sign the build +- Related: #RHEL-85961 + +* Tue Apr 1 2025 Nicolas Frayer 2.06-103 - fs/xfs: Sync with latest xfs upstream -- Resolves: #RHEL-85960 -- (NVR bump to catch up with zstream) +- Resolves: #RHEL-85961 -* Tue Mar 25 2025 Nicolas Frayer 2.06-100 +* Tue Mar 25 2025 Nicolas Frayer 2.06-102 - ieee1275/ofnet: Fix grub_malloc() removed after added safe -- Resolves: #RHEL-83117 +- Related: #RHEL-79846 -* Mon Mar 17 2025 Nicolas Frayer 2.06-99 +* Mon Mar 17 2025 Nicolas Frayer 2.06-101 - Added the following 2 commits to optimize memory consumption - tpm: Disable the tpm verifier if the TPM device is not present - powerpc: increase MIN RMA size for CAS negotiation - Resolves: #RHEL-76558 -* Mon Mar 10 2025 Leo Sandoval 2.06-98 +* Wed Mar 12 2025 Nicolas Frayer 2.06-100 +- Bump release for correct build tag +- Related: RHEL-79857 + +* Mon Mar 10 2025 Leo Sandoval 2.06-99 - Remove 'fs/ntfs: Implement attribute verification' patch -- Related: RHEL-83117 +- Related: RHEL-79857 + +* Fri Mar 7 2025 Nicolas Frayer - 2.06-98 +- Bump release for tagging +- Related: #RHEL-79846 * Wed Feb 26 2025 Nicolas Frayer - 2.06-97 - fs/ext2: Rework out-of-bounds read for inline and external extents