Hi Roland,
I discovered today that I was getting bad addresses for a simple
systemtap probe, process("/bin/env").function("main"). I tracked it
down to getting the module bias from dwfl_module_detdwarf, which AIUI
should always be zero for ET_EXEC. When this file is prelinked, we're
getting a non-zero bias.
This is a regression from 0.149, apparently due to the address_sync
logic added for the i386 REL->RELA fix. I'm on x86_64 this time, and
that /bin/env is from coreutils-8.5-7.fc14.x86_64. Jakub said that the
PT_LOAD heuristic should work fine for shared libraries, but suggested
for ET_EXEC that it might work better to compute the bias from
non-movable sections, or to parse the .gnu.prelink_undo section.
I've attached readelf -WlS for prelinked and not, and for the .debug. I
also uploaded those along with the actual binaries here:
http://jistone.fedorapeople.org/env-prelink-issue/
Thanks,
Josh
There are 41 section headers, starting at offset 0xfd30:
Section Headers:
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .interp NOBITS 0000000000400200 000200 00001c 00 A
0 0 1
[ 2] .note.ABI-tag NOTE 000000000040021c 000200 000020 00 A
0 0 4
[ 3] .note.gnu.build-id NOTE 000000000040023c 000220 000024 00 A
0 0 4
[ 4] .gnu.hash NOBITS 0000000000400260 000248 000038 00 A
5 0 8
[ 5] .dynsym NOBITS 0000000000400298 000248 000510 18 A
6 1 8
[ 6] .dynstr NOBITS 00000000004007a8 000248 000254 00 A
0 0 1
[ 7] .gnu.version NOBITS 00000000004009fc 000248 00006c 02 A
5 0 2
[ 8] .gnu.version_r NOBITS 0000000000400a68 000248 000050 00 A
6 1 8
[ 9] .rela.dyn NOBITS 0000000000400ab8 000248 000138 18 A
5 0 8
[10] .rela.plt NOBITS 0000000000400bf0 000248 000360 18 A
5 12 8
[11] .init NOBITS 0000000000400f50 000248 000018 00 AX
0 0 4
[12] .plt NOBITS 0000000000400f68 000248 000250 10 AX
0 0 4
[13] .text NOBITS 00000000004011c0 000250 002848 00 AX
0 0 16
[14] .fini NOBITS 0000000000403a08 000250 00000e 00 AX
0 0 4
[15] .rodata NOBITS 0000000000403a20 000260 000a31 00 A
0 0 32
[16] .eh_frame_hdr NOBITS 0000000000404454 000260 0001d4 00 A
0 0 4
[17] .eh_frame NOBITS 0000000000404628 000260 00071c 00 A
0 0 8
[18] .ctors NOBITS 0000000000605000 000260 000010 00 WA
0 0 8
[19] .dtors NOBITS 0000000000605010 000260 000010 00 WA
0 0 8
[20] .jcr NOBITS 0000000000605020 000260 000008 00 WA
0 0 8
[21] .data.rel.ro NOBITS 0000000000605040 000260 000108 00 WA
0 0 32
[22] .dynamic NOBITS 0000000000605148 000260 000190 10 WA
6 0 8
[23] .got NOBITS 00000000006052d8 000260 000070 08 WA
0 0 8
[24] .got.plt NOBITS 0000000000605348 000260 000138 08 WA
0 0 8
[25] .data NOBITS 0000000000605480 000260 000040 00 WA
0 0 16
[26] .bss NOBITS 00000000006054c0 000260 000180 00 WA
0 0 32
[27] .comment PROGBITS 0000000000000000 000260 00002c 01 MS
0 0 1
[28] .debug_aranges PROGBITS 0000000000000000 00028c 0001e0 00
0 0 1
[29] .debug_pubnames PROGBITS 0000000000000000 00046c 00050e 00
0 0 1
[30] .debug_info PROGBITS 0000000000000000 00097a 003a34 00
0 0 1
[31] .debug_abbrev PROGBITS 0000000000000000 0043ae 000f0f 00
0 0 1
[32] .debug_line PROGBITS 0000000000000000 0052bd 0011a4 00
0 0 1
[33] .debug_str PROGBITS 0000000000000000 006461 000cac 01 MS
0 0 1
[34] .debug_loc PROGBITS 0000000000000000 00710d 003a8a 00
0 0 1
[35] .debug_pubtypes PROGBITS 0000000000000000 00ab97 0003f5 00
0 0 1
[36] .debug_ranges PROGBITS 0000000000000000 00af8c 0004c0 00
0 0 1
[37] .gdb_index PROGBITS 0000000000000000 00b44c 0029fe 00
0 0 1
[38] .shstrtab STRTAB 0000000000000000 00de4a 00018f 00
0 0 1
[39] .symtab SYMTAB 0000000000000000 00dfe0 0012c0 18
40 83 8
[40] .strtab STRTAB 0000000000000000 00f2a0 000a90 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Elf file type is EXEC (Executable file)
Entry point 0x4011c0
There are 8 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz
Flg Align
PHDR 0x000040 0x0000000000400040 0x0000000000400040 0x0001c0
0x0001c0 R E 0x8
INTERP 0x000200 0x0000000000400200 0x0000000000400200 0x00001c
0x00001c R 0x1
[Requesting program interpreter: ]
LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x004d44
0x004d44 R E 0x200000
LOAD 0x005000 0x0000000000605000 0x0000000000605000 0x0004c0
0x000640 RW 0x200000
DYNAMIC 0x005148 0x0000000000605148 0x0000000000605148 0x000190
0x000190 RW 0x8
NOTE 0x00021c 0x000000000040021c 0x000000000040021c 0x000044
0x000044 R 0x4
GNU_EH_FRAME 0x004454 0x0000000000404454 0x0000000000404454 0x0001d4
0x0001d4 R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW 0x8
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 .comment .debug_aranges .debug_pubnames .debug_info
03 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss
04 .dynamic
05 .note.gnu.build-id
06 .eh_frame_hdr
07
There are 29 section headers, starting at offset 0x55d8:
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 0000000000400200 000200 00001c 00 A
0 0 1
[ 2] .note.ABI-tag NOTE 000000000040021c 00021c 000020 00 A
0 0 4
[ 3] .note.gnu.build-id NOTE 000000000040023c 00023c 000024 00 A
0 0 4
[ 4] .gnu.hash GNU_HASH 0000000000400260 000260 000038 00 A
5 0 8
[ 5] .dynsym DYNSYM 0000000000400298 000298 000510 18 A
6 1 8
[ 6] .dynstr STRTAB 00000000004007a8 0007a8 000254 00 A
0 0 1
[ 7] .gnu.version VERSYM 00000000004009fc 0009fc 00006c 02 A
5 0 2
[ 8] .gnu.version_r VERNEED 0000000000400a68 000a68 000050 00 A
6 1 8
[ 9] .rela.dyn RELA 0000000000400ab8 000ab8 000138 18 A
5 0 8
[10] .rela.plt RELA 0000000000400bf0 000bf0 000360 18 A
5 12 8
[11] .init PROGBITS 0000000000400f50 000f50 000018 00 AX
0 0 4
[12] .plt PROGBITS 0000000000400f68 000f68 000250 10 AX
0 0 4
[13] .text PROGBITS 00000000004011c0 0011c0 002848 00 AX
0 0 16
[14] .fini PROGBITS 0000000000403a08 003a08 00000e 00 AX
0 0 4
[15] .rodata PROGBITS 0000000000403a20 003a20 000a31 00 A
0 0 32
[16] .eh_frame_hdr PROGBITS 0000000000404454 004454 0001d4 00 A
0 0 4
[17] .eh_frame PROGBITS 0000000000404628 004628 00071c 00 A
0 0 8
[18] .ctors PROGBITS 0000000000605000 005000 000010 00 WA
0 0 8
[19] .dtors PROGBITS 0000000000605010 005010 000010 00 WA
0 0 8
[20] .jcr PROGBITS 0000000000605020 005020 000008 00 WA
0 0 8
[21] .data.rel.ro PROGBITS 0000000000605040 005040 000108 00 WA
0 0 32
[22] .dynamic DYNAMIC 0000000000605148 005148 000190 10 WA
6 0 8
[23] .got PROGBITS 00000000006052d8 0052d8 000070 08 WA
0 0 8
[24] .got.plt PROGBITS 0000000000605348 005348 000138 08 WA
0 0 8
[25] .data PROGBITS 0000000000605480 005480 000040 00 WA
0 0 16
[26] .bss NOBITS 00000000006054c0 0054c0 000180 00 WA
0 0 32
[27] .gnu_debuglink PROGBITS 0000000000000000 0054c0 000010 00
0 0 4
[28] .shstrtab STRTAB 0000000000000000 0054d0 000101 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Elf file type is EXEC (Executable file)
Entry point 0x4011c0
There are 8 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz
Flg Align
PHDR 0x000040 0x0000000000400040 0x0000000000400040 0x0001c0
0x0001c0 R E 0x8
INTERP 0x000200 0x0000000000400200 0x0000000000400200 0x00001c
0x00001c R 0x1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x004d44
0x004d44 R E 0x200000
LOAD 0x005000 0x0000000000605000 0x0000000000605000 0x0004c0
0x000640 RW 0x200000
DYNAMIC 0x005148 0x0000000000605148 0x0000000000605148 0x000190
0x000190 RW 0x8
NOTE 0x00021c 0x000000000040021c 0x000000000040021c 0x000044
0x000044 R 0x4
GNU_EH_FRAME 0x004454 0x0000000000404454 0x0000000000404454 0x0001d4
0x0001d4 R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW 0x8
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 .data.rel.ro .dynamic .got .got.plt .data .bss
04 .dynamic
05 .note.ABI-tag .note.gnu.build-id
06 .eh_frame_hdr
07
There are 32 section headers, starting at offset 0x62c0:
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 0000000000400200 000200 00001c 00 A
0 0 1
[ 2] .note.ABI-tag NOTE 000000000040021c 00021c 000020 00 A
0 0 4
[ 3] .note.gnu.build-id NOTE 000000000040023c 00023c 000024 00 A
0 0 4
[ 4] .gnu.hash GNU_HASH 0000000000400260 000260 000038 00 A
5 0 8
[ 5] .dynsym DYNSYM 0000000000400298 000298 000510 18 A
18 1 8
[ 6] .gnu.liblist GNU_LIBLIST 00000000004007a8 0007a8 000028 14 A
18 0 4
[ 7] .gnu.version VERSYM 00000000004009fc 0009fc 00006c 02 A
5 0 2
[ 8] .gnu.version_r VERNEED 0000000000400a68 000a68 000050 00 A
18 1 8
[ 9] .rela.dyn RELA 0000000000400ab8 000ab8 000138 18 A
5 0 8
[10] .rela.plt RELA 0000000000400bf0 000bf0 000360 18 A
5 12 8
[11] .init PROGBITS 0000000000400f50 000f50 000018 00 AX
0 0 4
[12] .plt PROGBITS 0000000000400f68 000f68 000250 10 AX
0 0 4
[13] .text PROGBITS 00000000004011c0 0011c0 002848 00 AX
0 0 16
[14] .fini PROGBITS 0000000000403a08 003a08 00000e 00 AX
0 0 4
[15] .rodata PROGBITS 0000000000403a20 003a20 000a31 00 A
0 0 32
[16] .eh_frame_hdr PROGBITS 0000000000404454 004454 0001d4 00 A
0 0 4
[17] .eh_frame PROGBITS 0000000000404628 004628 00071c 00 A
0 0 8
[18] .dynstr STRTAB 0000000000404d44 004d44 000270 00 A
0 0 1
[19] .ctors PROGBITS 0000000000605000 005000 000010 00 WA
0 0 8
[20] .dtors PROGBITS 0000000000605010 005010 000010 00 WA
0 0 8
[21] .jcr PROGBITS 0000000000605020 005020 000008 00 WA
0 0 8
[22] .data.rel.ro PROGBITS 0000000000605040 005040 000108 00 WA
0 0 32
[23] .dynamic DYNAMIC 0000000000605148 005148 000190 10 WA
18 0 8
[24] .got PROGBITS 00000000006052d8 0052d8 000070 08 WA
0 0 8
[25] .got.plt PROGBITS 0000000000605348 005348 000138 08 WA
0 0 8
[26] .data PROGBITS 0000000000605480 005480 000040 00 WA
0 0 16
[27] .bss PROGBITS 00000000006054c0 0054c0 000180 00 WA
0 0 32
[28] .gnu.conflict RELA 0000000000605640 005640 000240 18 A
5 0 8
[29] .gnu_debuglink PROGBITS 0000000000000000 005880 000010 00
0 0 4
[30] .gnu.prelink_undo PROGBITS 0000000000000000 005890 000900 01
0 0 8
[31] .shstrtab STRTAB 0000000000000000 006190 00012e 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Elf file type is EXEC (Executable file)
Entry point 0x4011c0
There are 8 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz
Flg Align
PHDR 0x000040 0x0000000000400040 0x0000000000400040 0x0001c0
0x0001c0 R E 0x8
INTERP 0x000200 0x0000000000400200 0x0000000000400200 0x00001c
0x00001c R 0x1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x004fb4
0x004fb4 R E 0x200000
LOAD 0x005000 0x0000000000605000 0x0000000000605000 0x000880
0x000880 RW 0x200000
DYNAMIC 0x005148 0x0000000000605148 0x0000000000605148 0x000190
0x000190 RW 0x8
NOTE 0x00021c 0x000000000040021c 0x000000000040021c 0x000044
0x000044 R 0x4
GNU_EH_FRAME 0x004454 0x0000000000404454 0x0000000000404454 0x0001d4
0x0001d4 R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW 0x8
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym
.gnu.liblist .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text
.fini .rodata .eh_frame_hdr .eh_frame .dynstr
03 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss
.gnu.conflict
04 .dynamic
05 .note.ABI-tag .note.gnu.build-id
06 .eh_frame_hdr
07
_______________________________________________
elfutils-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/elfutils-devel