From dfd50d908ab3a28ef51e655bae3b4925ef835d9e Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 12 Jul 2024 11:24:28 +0100 Subject: [PATCH] Additional patch (commit 31b4d3a16f200bf04db8439a63b72bba7af4e1be). Resolves: RHEL-45873 --- binutils-relro.patch | 54 ++++++++++++++++++++++++++++++++++++++++++++ binutils.spec | 5 +++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/binutils-relro.patch b/binutils-relro.patch index e60472e..a07c221 100644 --- a/binutils-relro.patch +++ b/binutils-relro.patch @@ -84,3 +84,57 @@ diff -rup binutils.orig/ld/ldlang.c binutils-2.35.2/ld/ldlang.c /* Adjust by the offset arg of XXX_SEGMENT_RELRO_END. */ desired_end = relro_end - seg->relro_offset; Only in binutils-2.35.2/ld: ldlang.c.orig +diff -rup binutils.orig/ld/emultempl/elf-x86.em binutils-2.35.2/ld/emultempl/elf-x86.em +--- binutils.orig/ld/emultempl/elf-x86.em 2024-07-12 10:24:52.597889981 +0100 ++++ binutils-2.35.2/ld/emultempl/elf-x86.em 2024-07-12 10:25:12.134935407 +0100 +@@ -33,6 +33,7 @@ static struct elf_linker_x86_params para + static void + elf_x86_create_output_section_statements (void) + { ++ config.relro_use_commonpagesize = TRUE; + _bfd_elf_linker_x86_set_options (&link_info, ¶ms); + } + +diff -rup binutils.orig/ld/ld.h binutils-2.35.2/ld/ld.h +--- binutils.orig/ld/ld.h 2024-07-12 10:24:52.620890034 +0100 ++++ binutils-2.35.2/ld/ld.h 2024-07-12 10:25:12.135935409 +0100 +@@ -280,6 +280,10 @@ typedef struct + /* If set, code and non-code sections should never be in one segment. */ + bfd_boolean separate_code; + ++ /* TRUE if the end of the relro segment should be aligned to ++ COMMONPAGESIZE rather than MAXPAGESIZE. */ ++ bfd_boolean relro_use_commonpagesize; ++ + /* The rpath separation character. Usually ':'. */ + char rpath_separator; + +Only in binutils-2.35.2/ld: ld.h.orig +diff -rup binutils.orig/ld/ldexp.c binutils-2.35.2/ld/ldexp.c +--- binutils.orig/ld/ldexp.c 2024-07-12 10:24:53.077891097 +0100 ++++ binutils-2.35.2/ld/ldexp.c 2024-07-12 10:25:12.136935412 +0100 +@@ -480,7 +480,10 @@ fold_segment_align (seg_align_type *seg, + seg->base = expld.result.value; + seg->commonpagesize = commonpage; + seg->maxpagesize = maxpage; +- seg->relropagesize = maxpage; ++ if (config.relro_use_commonpagesize) ++ seg->relropagesize = commonpage; ++ else ++ seg->relropagesize = maxpage; + seg->relro_end = 0; + } + else +Only in binutils-2.35.2/ld: ldexp.c.orig +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr18176.d binutils-2.35.2/ld/testsuite/ld-x86-64/pr18176.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr18176.d 2024-07-12 10:24:52.988890890 +0100 ++++ binutils-2.35.2/ld/testsuite/ld-x86-64/pr18176.d 2024-07-12 10:25:12.136935412 +0100 +@@ -3,6 +3,7 @@ + #ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000 + #readelf: -l --wide + #target: x86_64-*-linux* ++#xfail: *-*-* + + #... + GNU_RELRO 0x04bd17 0x000000000024bd17 0x000000000024bd17 0x0022e9 0x0022e9 R 0x1 +Only in binutils-2.35.2/ld/testsuite/ld-x86-64: pr18176.d.orig diff --git a/binutils.spec b/binutils.spec index ae0dd3a..9da3c8f 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.35.2 -Release: 49%{?dist} +Release: 50%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -1301,6 +1301,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Fri Jul 12 2024 Nick Clifton - 2.35.2-50 +- Additional patch (commit 31b4d3a16f200bf04db8439a63b72bba7af4e1be). (RHEL-45873) + * Thu Jul 11 2024 Nick Clifton - 2.35.2-49 - Remove the gap between LOAD segments when using RELRO. (RHEL-45873)