0

I have an aarch64 process (cat) running on an Android (8). I notice this section in /proc/<PID/maps:

746f308000-746f3de000 r-xp 00000000 103:00 5402    /system/lib64/libc++.so
746f3de000-746f3df000 ---p 00000000 00:00 0
746f3df000-746f3e7000 r--p 000d6000 103:00 5402    /system/lib64/libc++.so
746f3e7000-746f3e8000 rw-p 000d3000 103:00 5402    /system/lib64/libc++.so
746f3e8000-746f3eb000 rw-p 000de000 103:00 5402    [anon:.bss]
746f40e000- ... next file

Here's the program header table for libc++.so:

Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
PHDR           0x000040 0x0000000000009040 0x0000000000009040 0x0001c0 0x0001c0 R   0x8
LOAD           0x000000 0x0000000000009000 0x0000000000009000 0x0d58fc 0x0d58fc R E 0x1000
LOAD           0x0d68e0 0x00000000000e08e0 0x00000000000e08e0 0x007770 0x00aea8 RW  0x1000
DYNAMIC        0x0dbb40 0x00000000000e5b40 0x00000000000e5b40 0x000220 0x000220 RW  0x8
NOTE           0x000200 0x0000000000009200 0x0000000000009200 0x000038 0x000038 R   0x4
GNU_EH_FRAME   0x0d3058 0x00000000000dc058 0x00000000000dc058 0x0028a4 0x0028a4 R   0x4
GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0
GNU_RELRO      0x0d68e0 0x00000000000e08e0 0x00000000000e08e0 0x007720 0x007720 RW  0x10

Here's the section header for the .got.plt:

[Nr] Name        Type        Address          Off    Size   ES  Flg Lk  Inf Al
...
[22] .got.plt    PROGBITS    00000000000e6310 0dc310 001ce8 00  WA  0   0   8

Adding 0xe6310 to the base address, this section should be loaded at 0x746f3ee310. However, that lands between [anon:.bss] and the next file.

0

1 Answer 1

1
+100

The 746f308000-746f3de000 mapping corresponds to the first LOAD segment, which defines a 0x9000 virtual address. Taking this into account, you must first calculate the address difference between the .got.plt section and the first segment, and add that difference to the mapped base address; this is equivalent to substracting the 0x9000 offset to your resulting address 0x746f3ee310, that is 0x746f3e5310, which is in the third mapping.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .