Add ability to turn execstack warnings into errors.

Enable warnings for rsx segments.
This commit is contained in:
Nick Clifton 2023-10-19 14:07:53 +01:00
parent c2d4243912
commit e8094f532e
2 changed files with 63897 additions and 2 deletions

63876
binutils-execstack-error.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?_with_debug:-debug}
Version: 2.41
Release: 7%{?dist}
Release: 8%{?dist}
License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later LGPL-2.1-or-later AND LGPL-2.0-or-later
URL: https://sourceware.org/binutils
@ -35,7 +35,11 @@ URL: https://sourceware.org/binutils
%define warn_for_executable_stacks 1
# Generate a warning when linking creates a segment with read, write and execute permissions
%define warn_for_rwx_segments 0
%define warn_for_rwx_segments 1
# Turn the above warnings into errors. Only effective if the warnings are enabled.
%define error_for_executable_stacks 0
%define error_for_rwx_segments 0
# Enable support for GCC LTO compilation.
# Disable if it is necessary to work around bugs in LTO.
@ -261,6 +265,11 @@ Patch18: binutils-gold-powerpc.patch
# Lifetime: Fixed in 2.42
Patch19: binutils-handle-corrupt-version-info.patch
# Purpose: Add options to turn the bfd linker's warnings about executable
# stacks and rwx segments into errors.
# Lifetime: Fixed in 2.42
Patch20: binutils-execstack-error.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
@ -593,12 +602,18 @@ compute_global_configuration()
%if %{warn_for_executable_stacks}
CARGS="$CARGS --enable-warn-execstack=yes"
CARGS="$CARGS --enable-default-execstack=no"
%if %{error_for_executable_stacks}
CARGS="$CARGS --enable-error-execstack=yes"
%endif
%else
CARGS="$CARGS --enable-warn-execstack=no"
%endif
%if %{warn_for_rwx_segments}
CARGS="$CARGS --enable-warn-rwx-segments=yes"
%if %{error_for_rwx_segments}
CARGS="$CARGS --enable-error-rwx-segments=yes"
%endif
%else
CARGS="$CARGS --enable-warn-rwx-segments=no"
%endif
@ -1260,6 +1275,10 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Thu Oct 19 2023 Nick Clifton <nickc@redhat.com> - 2.41-8
- Add ability to turn execstack warnings into errors.
- Enable warnings for rsx segments.
* Fri Oct 13 2023 Nick Clifton <nickc@redhat.com> - 2.41-7
- Fix a potential NULL pointer derefence when parsing corrupt ELF symbol version information. (#2243769)