Bug 28743 - -z relro creats holes in the process image on GNU/Linux
Summary: -z relro creats holes in the process image on GNU/Linux
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.37
: P2 normal
Target Milestone: 2.38
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-03 15:34 UTC by Florian Weimer
Modified: 2024-02-15 04:55 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
ehframeopt.tar.gz (2.66 KB, application/octet-stream)
2022-01-04 15:33 UTC, Florian Weimer
Details
A patch (4.08 KB, patch)
2022-01-10 23:42 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Weimer 2022-01-03 15:34:56 UTC
BFD ld sometimes creates executables that have holes between PT_LOAD segments.

An example is /usr/bin/psql in postgresql-13.4-2.fc35.x86_64 (Fedora 35).

The kernel creates an actual hole, as can be seen from /proc/self/maps:

5591bcaa6000-5591bcab9000 r--p 00000000 103:02 271992                    /usr/bin/psql
5591bcab9000-5591bcb0b000 r-xp 00013000 103:02 271992                    /usr/bin/psql
5591bcb0b000-5591bcb49000 r--p 00065000 103:02 271992                    /usr/bin/psql
[49096 byte hole here]
5591bcb4a000-5591bcb52000 r--p 000a3000 103:02 271992                    /usr/bin/psql
5591bcb52000-5591bcb53000 rw-p 000ab000 103:02 271992                    /usr/bin/psql

I assume this position-independent executable was linked with -z separate-code (our toolchain default). binutils-2.37-10.fc35.x86_64 was used for this build.

This does not happen for all executables. I do not know the triggering conditions.
Comment 1 Andreas Schwab 2022-01-03 15:46:36 UTC
That's a 4096 byte hole.

What is the section to segment mapping?
Comment 2 Florian Weimer 2022-01-03 15:49:05 UTC
There are 31 section headers, starting at offset 0xad2b8:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000000000318 000318 00001c 00   A  0   0  1
  [ 2] .note.gnu.property NOTE            0000000000000338 000338 000050 00   A  0   0  8
  [ 3] .note.gnu.build-id NOTE            0000000000000388 000388 000024 00   A  0   0  4
  [ 4] .note.ABI-tag     NOTE            00000000000003ac 0003ac 000020 00   A  0   0  4
  [ 5] .gnu.hash         GNU_HASH        00000000000003d0 0003d0 0000b4 00   A  6   0  8
  [ 6] .dynsym           DYNSYM          0000000000000488 000488 001458 18   A  7   1  8
  [ 7] .dynstr           STRTAB          00000000000018e0 0018e0 000af7 00   A  0   0  1
  [ 8] .gnu.version      VERSYM          00000000000023d8 0023d8 0001b2 02   A  6   0  2
  [ 9] .gnu.version_r    VERNEED         0000000000002590 002590 0000c0 00   A  7   2  8
  [10] .rela.dyn         RELA            0000000000002650 002650 00f150 18   A  6   0  8
  [11] .rela.plt         RELA            00000000000117a0 0117a0 001200 18  AI  6  24  8
  [12] .init             PROGBITS        0000000000013000 013000 00001b 00  AX  0   0  4
  [13] .plt              PROGBITS        0000000000013020 013020 000c10 10  AX  0   0 16
  [14] .plt.sec          PROGBITS        0000000000013c30 013c30 000c00 10  AX  0   0 16
  [15] .text             PROGBITS        0000000000014830 014830 0505e2 00  AX  0   0 16
  [16] .fini             PROGBITS        0000000000064e14 064e14 00000d 00  AX  0   0  4
  [17] .rodata           PROGBITS        0000000000065000 065000 032dc0 00   A  0   0 32
  [18] .eh_frame_hdr     PROGBITS        0000000000097dc0 097dc0 000dc4 00   A  0   0  4
  [19] .eh_frame         PROGBITS        0000000000098b88 098b88 009ca8 00   A  0   0  8
  [20] .init_array       INIT_ARRAY      00000000000a4130 0a3130 000008 08  WA  0   0  8
  [21] .fini_array       FINI_ARRAY      00000000000a4138 0a3138 000008 08  WA  0   0  8
  [22] .data.rel.ro      PROGBITS        00000000000a4140 0a3140 007658 00  WA  0   0 32
  [23] .dynamic          DYNAMIC         00000000000ab798 0aa798 000220 10  WA  7   0  8
  [24] .got              PROGBITS        00000000000ab9b8 0aa9b8 000640 08  WA  0   0  8
  [25] .data             PROGBITS        00000000000ac000 0ab000 0004e0 00  WA  0   0 32
  [26] .bss              NOBITS          00000000000ac4e0 0ab4e0 000858 00  WA  0   0 32
  [27] .gnu.build.attributes NOTE            00000000000aed38 0ab4e0 000438 00      0   0  4
  [28] .gnu_debuglink    PROGBITS        0000000000000000 0ab918 000024 00      0   0  4
  [29] .gnu_debugdata    PROGBITS        0000000000000000 0ab93c 001838 00      0   0  1
  [30] .shstrtab         STRTAB          0000000000000000 0ad174 00013e 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), l (large), p (processor specific)

Elf file type is DYN (Position-Independent Executable file)
Entry point 0x15f50
There are 13 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0x0000000000000040 0x0000000000000040 0x0002d8 0x0002d8 R   0x8
  INTERP         0x000318 0x0000000000000318 0x0000000000000318 0x00001c 0x00001c R   0x1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0129a0 0x0129a0 R   0x1000
  LOAD           0x013000 0x0000000000013000 0x0000000000013000 0x051e21 0x051e21 R E 0x1000
  LOAD           0x065000 0x0000000000065000 0x0000000000065000 0x03d830 0x03d830 R   0x1000
  LOAD           0x0a3130 0x00000000000a4130 0x00000000000a4130 0x0083b0 0x008c08 RW  0x1000
  DYNAMIC        0x0aa798 0x00000000000ab798 0x00000000000ab798 0x000220 0x000220 RW  0x8
  NOTE           0x000338 0x0000000000000338 0x0000000000000338 0x000050 0x000050 R   0x8
  NOTE           0x000388 0x0000000000000388 0x0000000000000388 0x000044 0x000044 R   0x4
  GNU_PROPERTY   0x000338 0x0000000000000338 0x0000000000000338 0x000050 0x000050 R   0x8
  GNU_EH_FRAME   0x097dc0 0x0000000000097dc0 0x0000000000097dc0 0x000dc4 0x000dc4 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0x10
  GNU_RELRO      0x0a3130 0x00000000000a4130 0x00000000000a4130 0x007ed0 0x007ed0 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.property .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 
   03     .init .plt .plt.sec .text .fini 
   04     .rodata .eh_frame_hdr .eh_frame 
   05     .init_array .fini_array .data.rel.ro .dynamic .got .data .bss 
   06     .dynamic 
   07     .note.gnu.property 
   08     .note.gnu.build-id .note.ABI-tag 
   09     .note.gnu.property 
   10     .eh_frame_hdr 
   11     
   12     .init_array .fini_array .data.rel.ro .dynamic .got
Comment 3 Andreas Schwab 2022-01-03 16:29:00 UTC
I don't think separate-code has any influence here, since the hole is between two non-exec sections.

.eh_frame ends at 0xa2830, but .init_array starts at 0xa4130.  Perhaps the effect of .eh_frame optimisation.
Comment 4 Florian Weimer 2022-01-03 17:09:56 UTC
Could this be the result of running dwz on the binary? Thanks.
Comment 5 Andreas Schwab 2022-01-03 17:59:42 UTC
No, dwz optimizes the (separate) debug info.

eh-opt is a linker pass, see bfd/elf-eh-frame.c
Comment 6 H.J. Lu 2022-01-03 18:35:13 UTC
Can elf/tst-dl_find_object in glibc test be used as a testcase?
Comment 7 Florian Weimer 2022-01-03 19:33:44 UTC
(In reply to H.J. Lu from comment #6)
> Can elf/tst-dl_find_object in glibc test be used as a testcase?

I don't think so. The failure you saw has a different cause: we do not initialize l_contiguous for the main map at all. My elf/tst-dl_find_object binary is actually contiguous.
Comment 8 H.J. Lu 2022-01-03 19:40:34 UTC
Need a self contained testcase.
Comment 9 Florian Weimer 2022-01-04 15:33:03 UTC
Created attachment 13890 [details]
ehframeopt.tar.gz

A reproducer.

$ ./ehframeopt  | head -n 5
00400000-00401000 r--p 00000000 00:25 506445                             /tmp/ehframeopt/ehframeopt
00401000-00407000 r-xp 00001000 00:25 506445                             /tmp/ehframeopt/ehframeopt
00407000-0040f000 r--p 00007000 00:25 506445                             /tmp/ehframeopt/ehframeopt
00410000-00411000 r--p 0000f000 00:25 506445                             /tmp/ehframeopt/ehframeopt
00411000-00412000 rw-p 00010000 00:25 506445                             /tmp/ehframeopt/ehframeopt

Gap is before the 00410000 line.  The reproducer is a bit fickle, the gap doesn't grow larger merely by increasing the number of object files.

Note that I called this ehframeopt, but I don't know of that's the culprit. Jakub points towards bug 23704.
Comment 10 H.J. Lu 2022-01-09 20:07:05 UTC
Hole is created by RELRO:

  .eh_frame_hdr   : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  .gnu_extab   : ONLY_IF_RO { *(.gnu_extab*) }
  /* These sections are generated by the Sun/Oracle C++ compiler.  */
  .exception_ranges   : ONLY_IF_RO { *(.exception_ranges*) }
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  /* Exception handling  */
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  .gnu_extab      : ONLY_IF_RW { *(.gnu_extab) }
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  .exception_ranges   : ONLY_IF_RW { *(.exception_ranges*) }
  /* Thread Local Storage sections  */
  .tdata          :
   {
     PROVIDE_HIDDEN (__tdata_start = .);
     *(.tdata .tdata.* .gnu.linkonce.td.*)
   }
  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  .preinit_array    :
  {
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array))
    PROVIDE_HIDDEN (__preinit_array_end = .);
  }
  .init_array    :
  {
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
    KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
    PROVIDE_HIDDEN (__init_array_end = .);
  }
Comment 11 H.J. Lu 2022-01-10 00:07:34 UTC
lang_size_relro_segment should remove a one-page padding before GNU_RELRO
segment.
Comment 12 H.J. Lu 2022-01-10 13:44:17 UTC
A simple testcase:

[hjl@gnu-tgl-3 pr28743-2]$ cat relro1.s 
	.globl main
	.globl start
	.globl _start
	.globl __start
	.text
main:
start:
_start:
__start:
	.long	0
	.data
	.long	0
	.section .data.rel.ro,"aw",%progbits
	.long	0
[hjl@gnu-tgl-3 pr28743-2]$ make
as -mx86-used-note=no  -o relro1.o relro1.s
./ld -z noseparate-code -z relro -o relro1 relro1.o
readelf -lSW relro1
There are 7 section headers, starting at offset 0x1128:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000004000e8 0000e8 000004 00  AX  0   0  1
  [ 2] .data.rel.ro      PROGBITS        0000000000401ffc 000ffc 000004 00  WA  0   0  1
  [ 3] .data             PROGBITS        0000000000402000 001000 000004 00  WA  0   0  1
  [ 4] .symtab           SYMTAB          0000000000000000 001008 0000c0 18      5   1  8
  [ 5] .strtab           STRTAB          0000000000000000 0010c8 000026 00      0   0  1
  [ 6] .shstrtab         STRTAB          0000000000000000 0010ee 000034 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), l (large), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x4000e8
There are 3 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x0000ec 0x0000ec R E 0x1000
  LOAD           0x000ffc 0x0000000000401ffc 0x0000000000401ffc 0x000008 0x000008 RW  0x1000
  GNU_RELRO      0x000ffc 0x0000000000401ffc 0x0000000000401ffc 0x000004 0x000004 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .text 
   01     .data.rel.ro .data 
   02     .data.rel.ro 
[hjl@gnu-tgl-3 pr28743-2]$
Comment 13 H.J. Lu 2022-01-10 23:42:04 UTC
Created attachment 13897 [details]
A patch
Comment 14 H.J. Lu 2022-01-10 23:43:01 UTC
(In reply to Florian Weimer from comment #9)
> Created attachment 13890 [details]
> ehframeopt.tar.gz
> 
> A reproducer.
> 
> $ ./ehframeopt  | head -n 5
> 00400000-00401000 r--p 00000000 00:25 506445                            
> /tmp/ehframeopt/ehframeopt
> 00401000-00407000 r-xp 00001000 00:25 506445                            
> /tmp/ehframeopt/ehframeopt
> 00407000-0040f000 r--p 00007000 00:25 506445                            
> /tmp/ehframeopt/ehframeopt
> 00410000-00411000 r--p 0000f000 00:25 506445                            
> /tmp/ehframeopt/ehframeopt
> 00411000-00412000 rw-p 00010000 00:25 506445                            
> /tmp/ehframeopt/ehframeopt
> 
> Gap is before the 00410000 line.  The reproducer is a bit fickle, the gap
> doesn't grow larger merely by increasing the number of object files.
> 

Florian, can you try my patch?
Comment 15 Sourceware Commits 2022-01-13 13:27:09 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2f83249c13d86065b4c7cdb198ea871017b4bba1

commit 2f83249c13d86065b4c7cdb198ea871017b4bba1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jan 10 15:26:18 2022 -0800

    elf: Remove the 1-page gap before the RELRO segment
    
    The existing RELRO scheme may leave a 1-page gap before the RELRO segment
    and align the end of the RELRO segment to the page size:
    
      [18] .eh_frame    PROGBITS    408fa0 008fa0 005e80 00   A  0   0  8
      [19] .init_array  INIT_ARRAY  410de0 00fde0 000008 08  WA  0   0  8
      [20] .fini_array  FINI_ARRAY  410de8 00fde8 000008 08  WA  0   0  8
      [21] .dynamic     DYNAMIC     410df0 00fdf0 000200 10  WA  7   0  8
      [22] .got         PROGBITS    410ff0 00fff0 000010 08  WA  0   0  8
      [23] .got.plt     PROGBITS    411000 010000 000048 08  WA  0   0  8
    
    Instead, we can remove the 1-page gap if the maximum page size >= the
    maximum section alignment:
    
      [18] .eh_frame    PROGBITS    408fa0 008fa0 005e80 00   A  0   0  8
      [19] .init_array  INIT_ARRAY  40fde0 00fde0 000008 08  WA  0   0  8
      [20] .fini_array  FINI_ARRAY  40fde8 00fde8 000008 08  WA  0   0  8
      [21] .dynamic     DYNAMIC     40fdf0 00fdf0 000200 10  WA  7   0  8
      [22] .got         PROGBITS    40fff0 00fff0 000010 08  WA  0   0  8
      [23] .got.plt     PROGBITS    410000 010000 000048 08  WA  0   0  8
    
    Because the end of the RELRO segment is always aligned to the page size
    and may not be moved, the RELRO segment size may be increased:
    
      [ 3] .dynstr      STRTAB      000148 000148 000001 00   A  0   0  1
      [ 4] .eh_frame    PROGBITS    000150 000150 000000 00   A  0   0  8
      [ 5] .init_array  INIT_ARRAY  200150 000150 000010 08  WA  0   0  1
      [ 6] .fini_array  FINI_ARRAY  200160 000160 000010 08  WA  0   0  1
      [ 7] .jcr         PROGBITS    200170 000170 000008 00  WA  0   0  1
      [ 8] .data.rel.ro PROGBITS    200180 000180 000020 00  WA  0   0 16
      [ 9] .dynamic     DYNAMIC     2001a0 0001a0 0001c0 10  WA  3   0  8
      [10] .got         PROGBITS    200360 000360 0002a8 00  WA  0   0  8
      [11] .bss         NOBITS      201000 000608 000840 00  WA  0   0  1
    
    vs the old section layout:
    
      [ 3] .dynstr      STRTAB      000148 000148 000001 00   A  0   0  1
      [ 4] .eh_frame    PROGBITS    000150 000150 000000 00   A  0   0  8
      [ 5] .init_array  INIT_ARRAY  200b48 000b48 000010 08  WA  0   0  1
      [ 6] .fini_array  FINI_ARRAY  200b58 000b58 000010 08  WA  0   0  1
      [ 7] .jcr         PROGBITS    200b68 000b68 000008 00  WA  0   0  1
      [ 8] .data.rel.ro PROGBITS    200b70 000b70 000020 00  WA  0   0 16
      [ 9] .dynamic     DYNAMIC     200b90 000b90 0001c0 10  WA  3   0  8
      [10] .got         PROGBITS    200d50 000d50 0002a8 00  WA  0   0  8
      [11] .bss         NOBITS      201000 000ff8 000840 00  WA  0   0  1
    
    But there is no 1-page gap.
    
            PR ld/28743
            * ldlang.c (lang_size_relro_segment_1): Remove the 1-page gap
            before the RELRO segment if the maximum page size >= the maximum
            section alignment.
            * testsuite/ld-i386/pr20830.d: Adjusted.
            * testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
            * testsuite/ld-x86-64/pr14207.d: Likewise.
            * testsuite/ld-x86-64/pr18176.d: Likewise.
            * testsuite/ld-x86-64/pr20830a-now.d: Likewise.
            * testsuite/ld-x86-64/pr20830a.d: Likewise.
            * testsuite/ld-x86-64/pr20830b-now.d: Likewise.
            * testsuite/ld-x86-64/pr20830b.d: Likewise.
            * testsuite/ld-x86-64/pr21038a-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038a.d: Likewise.
            * testsuite/ld-x86-64/pr21038b-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038c.d: Likewise.
Comment 16 H.J. Lu 2022-01-13 14:26:58 UTC
Fixed for 2.38.
Comment 17 Sourceware Commits 2022-01-26 13:32:29 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c804c6f98d342c3d46f73d7a7ec6229d5ab1c9f3

commit c804c6f98d342c3d46f73d7a7ec6229d5ab1c9f3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jan 14 13:48:36 2022 -0800

    ld: Rewrite lang_size_relro_segment_1
    
    1. Compute the desired PT_GNU_RELRO segment base and find the maximum
    section alignment of sections starting from the PT_GNU_RELRO segment.
    2. Find the first preceding load section.
    3. Don't add the 1-page gap between the first preceding load section and
    the relro segment if the maximum page size >= the maximum section
    alignment.  Align the PT_GNU_RELRO segment first.  Subtract the maximum
    page size if therer is still a 1-page gap.
    
            PR ld/28743
            PR ld/28819
            * ldlang.c (lang_size_relro_segment_1): Rewrite.
            * testsuite/ld-x86-64/pr28743-1.d: New file.
            * testsuite/ld-x86-64/pr28743-1.s: Likewise.
            * testsuite/ld-x86-64/x86-64.exp: Run pr28743-1.
Comment 18 Sourceware Commits 2022-01-26 13:47:13 UTC
The binutils-2_38-branch branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8b7c6a1fbab5b0efc6abb50cdb24aef3954ac018

commit 8b7c6a1fbab5b0efc6abb50cdb24aef3954ac018
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jan 14 13:48:36 2022 -0800

    ld: Rewrite lang_size_relro_segment_1
    
    1. Compute the desired PT_GNU_RELRO segment base and find the maximum
    section alignment of sections starting from the PT_GNU_RELRO segment.
    2. Find the first preceding load section.
    3. Don't add the 1-page gap between the first preceding load section and
    the relro segment if the maximum page size >= the maximum section
    alignment.  Align the PT_GNU_RELRO segment first.  Subtract the maximum
    page size if therer is still a 1-page gap.
    
            PR ld/28743
            PR ld/28819
            * ldlang.c (lang_size_relro_segment_1): Rewrite.
            * testsuite/ld-x86-64/pr28743-1.d: New file.
            * testsuite/ld-x86-64/pr28743-1.s: Likewise.
            * testsuite/ld-x86-64/x86-64.exp: Run pr28743-1.
    
    (cherry picked from commit c804c6f98d342c3d46f73d7a7ec6229d5ab1c9f3)
Comment 19 Sourceware Commits 2022-02-07 03:13:49 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5197c88e2a8a17f7a67ce683df068b5bdf619427

commit 5197c88e2a8a17f7a67ce683df068b5bdf619427
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Feb 5 20:01:40 2022 +1030

    Revert "ld: Rewrite lang_size_relro_segment_1"
    
    This reverts commit c804c6f98d342c3d46f73d7a7ec6229d5ab1c9f3.
    
            PR ld/28743
            PR ld/28819
            * ldlang.c (lang_size_relro_segment_1): Revert 2022-01-14 change.
            * testsuite/ld-x86-64/pr28743-1.d: Likewise.
            * testsuite/ld-x86-64/pr28743-1.s: Likewise.
            * testsuite/ld-x86-64/x86-64.exp: Likewise.
Comment 20 Sourceware Commits 2022-02-07 03:13:54 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6a9d08661b361e497baa76dd6d8685f2cb593adb

commit 6a9d08661b361e497baa76dd6d8685f2cb593adb
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Feb 5 20:06:52 2022 +1030

    Revert "elf: Remove the 1-page gap before the RELRO segment"
    
    This reverts commit 2f83249c13d86065b4c7cdb198ea871017b4bba1.
    
            PR ld/28743
            * ldlang.c (lang_size_relro_segment_1): Revert 2022-01-10 changes.
            * testsuite/ld-i386/pr20830.d: Likewise.
            * testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
            * testsuite/ld-x86-64/pr14207.d: Likewise.
            * testsuite/ld-x86-64/pr18176.d: Likewise.
            * testsuite/ld-x86-64/pr20830a-now.d: Likewise.
            * testsuite/ld-x86-64/pr20830a.d: Likewise.
            * testsuite/ld-x86-64/pr20830b-now.d: Likewise.
            * testsuite/ld-x86-64/pr20830b.d: Likewise.
            * testsuite/ld-x86-64/pr21038a-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038a.d: Likewise.
            * testsuite/ld-x86-64/pr21038b-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038c.d: Likewise.
Comment 21 Sourceware Commits 2022-02-07 03:13:59 UTC
The binutils-2_38-branch branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fb42d68c3d694a2e2344d9ae65444e6cc761cb4f

commit fb42d68c3d694a2e2344d9ae65444e6cc761cb4f
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Feb 7 09:37:51 2022 +1030

    Revert "ld: Rewrite lang_size_relro_segment_1"
    
    This reverts commit 8b7c6a1fbab5b0efc6abb50cdb24aef3954ac018.
    
            PR ld/28743
            PR ld/28819
            * ldlang.c (lang_size_relro_segment_1): Revert 2022-01-14 change.
            testsuite/ld-x86-64/pr28743-1.d: Likewise.
            testsuite/ld-x86-64/pr28743-1.s: Likewise.
            testsuite/ld-x86-64/x86-64.exp: Likewise.
Comment 22 Sourceware Commits 2022-02-07 03:14:05 UTC
The binutils-2_38-branch branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7e4cfa21001ed59245ec638fe51ef9de6e20d344

commit 7e4cfa21001ed59245ec638fe51ef9de6e20d344
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Feb 7 09:42:03 2022 +1030

    Revert "elf: Remove the 1-page gap before the RELRO segment"
    
    This reverts commit 2f83249c13d86065b4c7cdb198ea871017b4bba1.
    
            PR ld/28743
            * ldlang.c (lang_size_relro_segment_1): Revert 2022-01-10 changes.
            * testsuite/ld-i386/pr20830.d: Likewise.
            * testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
            * testsuite/ld-x86-64/pr14207.d: Likewise.
            * testsuite/ld-x86-64/pr18176.d: Likewise.
            * testsuite/ld-x86-64/pr20830a-now.d: Likewise.
            * testsuite/ld-x86-64/pr20830a.d: Likewise.
            * testsuite/ld-x86-64/pr20830b-now.d: Likewise.
            * testsuite/ld-x86-64/pr20830b.d: Likewise.
            * testsuite/ld-x86-64/pr21038a-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038a.d: Likewise.
            * testsuite/ld-x86-64/pr21038b-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
            * testsuite/ld-x86-64/pr21038c.d: Likewise.
Comment 23 H.J. Lu 2022-02-07 04:06:41 UTC
Reopened.
Comment 24 Alan Modra 2024-02-15 04:55:13 UTC
This was fixed with 9833b7757d24