Revert "PR28824, relro security issues, x86 keep COMMONPAGESIZE relro"
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 15 Feb 2022 00:02:45 +0000 (16:02 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 15 Feb 2022 01:39:34 +0000 (17:39 -0800)
This reverts commit 31b4d3a16f200bf04db8439a63b72bba7af4e1be.

ld/emultempl/elf-x86.em
ld/ld.h
ld/ldexp.c
ld/testsuite/ld-x86-64/pr18176.d

index 134e4e1b61621ceb9eb55ef478a4d1affa51bcee..f75521cecea7367fa4463e54742874ce28ca113b 100644 (file)
@@ -33,7 +33,6 @@ static struct elf_linker_x86_params params;
 static void
 elf_x86_create_output_section_statements (void)
 {
-  config.relro_use_commonpagesize = true;
   _bfd_elf_linker_x86_set_options (&link_info, &params);
 }
 
diff --git a/ld/ld.h b/ld/ld.h
index c7e4ca3d334eafa76e23a499e5004df0a37c774b..f3086bf30dee354bf4f5e1329bf0ebaec2a939e3 100644 (file)
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -276,10 +276,6 @@ typedef struct
   /* If set, code and non-code sections should never be in one segment.  */
   bool separate_code;
 
-  /* TRUE if the end of the relro segment should be aligned to
-     COMMONPAGESIZE rather than MAXPAGESIZE.  */
-  bool relro_use_commonpagesize;
-
   /* The rpath separation character.  Usually ':'.  */
   char rpath_separator;
 
index 90760e0a8cac1a79b0d4a7098fecef64cc62f586..c18b8284ca513830ed7ab198ae1ca4cffee14f04 100644 (file)
@@ -485,10 +485,7 @@ fold_segment_align (etree_value_type *lhs)
              seg->base = expld.result.value;
              seg->commonpagesize = commonpage;
              seg->maxpagesize = maxpage;
-             if (config.relro_use_commonpagesize)
-               seg->relropagesize = commonpage;
-             else
-               seg->relropagesize = maxpage;
+             seg->relropagesize = maxpage;
              seg->relro_end = 0;
            }
          else
index 728c15a3dd8bfe6da02da0742140d10ab4319881..a99ff15ac6bee23984d9c8bb70d2c586a710150b 100644 (file)
@@ -3,7 +3,6 @@
 #ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000 $NO_DT_RELR_LDFLAGS
 #readelf: -l --wide
 #target: x86_64-*-linux*
-#xfail: *-*-*
 
 #...
   GNU_RELRO      0x04bd17 0x000000000024bd17 0x000000000024bd17 0x0022e9 0x0022e9 R   0x1