[Bug sanitizer/59410] tsan tests fail with address randomization disabled
kcc at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 6 17:36:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59410
--- Comment #20 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
> >
> > # readelf -lW a.out
>
> Your address must be sensible. Otherwise kernel will ignore it.
> Please try "-Ttext-segment 0x855555000000".
How is 0x855555000000 censible if it's beyond the address space?
(Or I miss something?)
Anyway, here is an experiment that proves that on my box
-Ttext-segment is ignored if ASLR is off.
% cat print_main.cc
#include <stdio.h>
int main() {
printf("main: %p\n", &main);
}
% g++ print_main.cc -fPIE -pie -Wl,-Ttext-segment=0x6ABC55000000 && ./a.out
main: 0x6abc5500072c
% g++ print_main.cc -fPIE -pie -Wl,-Ttext-segment=0x6ABC55000000 && setarch
x86_64 -R ./a.out
main: 0x55555555472c
% readelf -lW ./a.out
Elf file type is DYN (Shared object file)
Entry point 0x6abc55000630
There are 9 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz
Flg Align
PHDR 0x000040 0x00006abc55000040 0x00006abc55000040 0x0001f8
0x0001f8 R E 0x8
INTERP 0x000238 0x00006abc55000238 0x00006abc55000238 0x00001c
0x00001c R 0x1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x000000 0x00006abc55000000 0x00006abc55000000 0x00091c
0x00091c R E 0x200000
LOAD 0x000e00 0x00006abc55200e00 0x00006abc55200e00 0x000228
0x000238 RW 0x200000
DYNAMIC 0x000e28 0x00006abc55200e28 0x00006abc55200e28 0x000190
0x000190 RW 0x8
NOTE 0x000254 0x00006abc55000254 0x00006abc55000254 0x000044
0x000044 R 0x4
GNU_EH_FRAME 0x000848 0x00006abc55000848 0x00006abc55000848 0x00002c
0x00002c R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW 0x8
GNU_RELRO 0x000e00 0x00006abc55200e00 0x00006abc55200e00 0x000200
0x000200 R 0x1
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr
.gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata
.eh_frame_hdr .eh_frame
03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
04 .dynamic
05 .note.ABI-tag .note.gnu.build-id
06 .eh_frame_hdr
07
08 .ctors .dtors .jcr .dynamic .got
More information about the Gcc-bugs
mailing list