From 00415f44d2e02114c009aa18e93a1b054f296397 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 21 Nov 2023 10:17:22 +0000 Subject: [PATCH] Enable errors for executable stacks. --- binutils-execstack-error.patch | 32 ++++++++++++++++++++++++++++++++ binutils.spec | 9 ++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/binutils-execstack-error.patch b/binutils-execstack-error.patch index a87a795..2ec975d 100644 --- a/binutils-execstack-error.patch +++ b/binutils-execstack-error.patch @@ -1479,3 +1479,35 @@ diff -rupN binutils.orig/ld/testsuite/ld-x86-64/pr23189.d binutils-2.41/ld/tests #readelf: -r --wide There are no relocations in this file. +--- binutils.orig/bfd/elflink.c 2023-11-14 13:16:18.706749224 +0000 ++++ binutils-2.41/bfd/elflink.c 2023-11-14 13:17:27.584837271 +0000 +@@ -7150,14 +7150,6 @@ bfd_elf_size_dynamic_sections (bfd *outp + though the choice is the result of another command line option. */ + if (info->warn_execstack == 1) + { +- if (info->error_execstack) +- { +- _bfd_error_handler +- (_("\ +-error: creating an executable stack because of -z execstack command line option")); +- return false; +- } +- + _bfd_error_handler + (_("\ + warning: enabling an executable stack because of -z execstack command line option")); +@@ -7219,14 +7211,6 @@ warning: enabling an executable stack be + on the command line. */ + if (noteobj) + { +- if (info->error_execstack) +- { +- _bfd_error_handler (_("\ +-error: %s: is triggering the generation of an executable stack (because it has an executable .note.GNU-stack section)"), +- bfd_get_filename (noteobj)); +- return false; +- } +- + _bfd_error_handler (_("\ + warning: %s: requires executable stack (because the .note.GNU-stack section is executable)"), + bfd_get_filename (noteobj)); diff --git a/binutils.spec b/binutils.spec index c323e32..b439ebf 100644 --- a/binutils.spec +++ b/binutils.spec @@ -2,7 +2,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.41 -Release: 13%{?dist} +Release: 14%{?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 @@ -38,8 +38,8 @@ URL: https://sourceware.org/binutils %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 +%define error_for_executable_stacks 1 +%define error_for_rwx_segments 1 # Enable support for GCC LTO compilation. # Disable if it is necessary to work around bugs in LTO. @@ -1295,6 +1295,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Tue Nov 21 2023 Nick Clifton - 2.41-14 +- Enable errors for executable stacks. + * Fri Nov 10 2023 Nick Clifton - 2.41-13 - Make the GOLD linker ignore the "-z pack-relative-relocs" option. (#2248936)