This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: dynrelro section for read-only dynamic symbols copied into executable
- From: Palmer Dabbelt <palmer at dabbelt dot com>
- To: amodra at gmail dot com
- Cc: Andrew Waterman <andrew at sifive dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 29 Dec 2016 10:20:06 -0800 (PST)
- Subject: Re: dynrelro section for read-only dynamic symbols copied into executable
- Authentication-results: sourceware.org; auth=none
On Sun, 25 Dec 2016 21:44:48 PST (-0800), amodra@gmail.com wrote:
> riscv scripts are hosed for -z relro.
Andrew and I can't figure out why relro is broken on RISC-V. I looked at our
linker scripts (via riscv64-unknown-linux-gnu-gcc -Wl,-verbose) and the .rel.ro
section looks the same as on my x86 machine, and it's in a similar order to the
x86 one (the got has moved a bit, but there's a comment for why it's in a
slightly different place). Additionally, I readelf'd some arbitrary executable
and it appears that the GNU_RELRO segment is read-only
$ riscv64-unknown-linux-gnu-readelf -l install/sysroot/usr/bin/locale
Elf file type is EXEC (Executable file)
Entry point 0x168a4
There are 9 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000010040 0x0000000000010040
0x00000000000001f8 0x00000000000001f8 R E 0x8
INTERP 0x0000000000000238 0x0000000000010238 0x0000000000010238
0x0000000000000014 0x0000000000000014 R 0x1
[Requesting program interpreter: /lib64/lp64/ld.so.1]
LOAD 0x0000000000000000 0x0000000000010000 0x0000000000010000
0x00000000000039b4 0x00000000000039f8 RW 0x1000
LOAD 0x00000000000039f8 0x00000000000149f8 0x00000000000149f8
0x00000000000047e4 0x00000000000047e4 R E 0x1000
LOAD 0x0000000000008e00 0x000000000001ae00 0x000000000001ae00
0x0000000000000438 0x0000000000000438 RW 0x1000
DYNAMIC 0x0000000000008e20 0x000000000001ae20 0x000000000001ae20
0x00000000000001e0 0x00000000000001e0 RW 0x8
NOTE 0x000000000000024c 0x000000000001024c 0x000000000001024c
0x0000000000000020 0x0000000000000020 R 0x4
GNU_EH_FRAME 0x0000000000008194 0x0000000000019194 0x0000000000019194
0x0000000000000014 0x0000000000000014 R 0x4
GNU_RELRO 0x0000000000008e00 0x000000000001ae00 0x000000000001ae00
0x0000000000000200 0x0000000000000200 R 0x1
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .data .rodata .sdata .sbss .bss
03 .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .plt .text .eh_frame_hdr .eh_frame
04 .preinit_array .init_array .fini_array .jcr .dynamic .got
05 .dynamic
06 .note.ABI-tag
07 .eh_frame_hdr
08 .preinit_array .init_array .fini_array .jcr .dynamic
I saw your metage relro patch go by, but we have COMMONPAGESIZE so I don't
think that's the problem.
Can you (or anyone else) offer a hint? We'd love to get this fixed, we just
didn't know about the problem.
Thanks for the heads up!