Revert annobin's regex removal into cflags_sed

Besides re-introducing the annobin sed replacements, it fixes
duplicate '-fstack-protector-strong' flags and remove the sed
replacement '-fno-stack-protector' as it has no effect.

Resolves: #RHEL-89464

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
This commit is contained in:
Leo Sandoval 2025-08-15 13:09:17 -06:00
parent e041fb0c9b
commit 6b3c891675
2 changed files with 9 additions and 4 deletions

View File

@ -25,7 +25,8 @@
%global cflags_sed \\\
sed \\\
-e 's/-O. //g' \\\
-e 's/-fno-stack-protector//g' \\\
-e 's/-fplugin=annobin//g' \\\
-e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]*,,g' \\\
-e 's/-[^ ]*D_FORTIFY_SOURCE=[[:digit:]][^ ]*\\+//g' \\\
-e 's/--param=ssp-buffer-size=4//g' \\\
-e 's/-mregparm=3/-mregparm=4/g' \\\
@ -35,7 +36,7 @@
-e 's/^/ -fno-strict-aliasing /' \\\
%{nil}
%global host_cflags_ %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} -fstack-protector-strong | %{cflags_sed})}
%global host_cflags_ %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})}
%ifarch x86_64
%global host_cflags %{host_cflags_} -fcf-protection
%else
@ -49,7 +50,7 @@
)}
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}
%global target_cflags %{expand:%%(echo %{build_cflags} -fstack-protector-strong | %{cflags_sed})}
%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})} -fstack-protector-strong
%global legacy_target_cflags \\\
%{expand:%%(echo %{target_cflags} | \\\
%{cflags_sed} \\\

View File

@ -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/
@ -574,6 +574,10 @@ fi
%endif
%changelog
* Fri Aug 15 2025 Leo Sandoval <lsandova@redhat.com> 2.12-27
- Revert annobin's regex removal into cflags_sed
- Resolves: #RHEL-89464
* Thu Jul 31 2025 Leo Sandoval <lsandova@redhat.com> 2.12-26
- Enable strong stack protector on EFI configurations
- Resolves: #RHEL-89464