[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#696556: ldd: segfault with binaries with big segment




The problem is default load address for PIE/DSO.
There is not enough space between default address for binaries
and default address for PIE/DSO. There is at most 12 MB :-(

The base address for binaries (/usr/lib/ldscripts/*)
kfreebsd-i386  - 0x08048000.
kfreebsd-amd64 -   0x400000.

Default address for PIE/DSO (inside kernel sources)
kfreebsd-i386  - 0x01001000
kfreebsd-amd64 - 0x01021000

The linux kernel does not use fixed address for PIE,
it uses the place where DSO could be loaded.

We could either alter default address for PIE/DSO (inside kernel sources),
or alter base address for binaries (binary would be loaded after default PIE/DSO) or specify address for ld.so during libc build.

The new reasonable ET_DYN_LOAD_ADDR might be 0x101021000.


# /lib/ld-kfreebsd-x86-64.so.1 /bin/cat /proc/self/maps | cut -f 1-2,6- -d " "
00400000-0040c000 r-xp     /bin/cat
0060b000-0060c000 r--p     /bin/cat
0060c000-0060d000 rw-p     /bin/cat
01021000-01040000 r-xp     /lib/x86_64-kfreebsd-gnu/ld-2.13.so
0123f000-01240000 r--p     /lib/x86_64-kfreebsd-gnu/ld-2.13.so
01240000-01242000 rw-p
59ec9f000-59eca1000 rw-p
59eca1000-59ecbd000 r--p     /etc/ld.so.cache
59ecbd000-59edff000 r-xp     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59edff000-59efff000 ---p     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59efff000-59f003000 r--p     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59f003000-59f005000 rw-p     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59f005000-59f10b000 rw-p
7ffffffdf000-7ffffffff000 rwxp
7ffffffff000-800000000000 r-xp


# /bin/cat /proc/self/maps | cut -f 1-2,6- -d " "
00400000-0040c000 r-xp     /bin/cat
0060b000-0060c000 r--p     /bin/cat
0060c000-0062e000 rw-p
59e06b000-59e08a000 r-xp     /lib/x86_64-kfreebsd-gnu/ld-2.13.so
59e08a000-59e08c000 rw-p
59e08c000-59e0a8000 r--p     /etc/ld.so.cache
59e0a8000-59e0aa000 rw-p
59e289000-59e28a000 r--p     /lib/x86_64-kfreebsd-gnu/ld-2.13.so
59e28a000-59e28c000 rw-p
59e28c000-59e3ce000 r-xp     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59e3ce000-59e5ce000 ---p     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59e5ce000-59e5d2000 r--p     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59e5d2000-59e5d4000 rw-p     /lib/x86_64-kfreebsd-gnu/libc-2.13.so
59e5d4000-59e5d8000 rw-p
7ffffffdf000-7ffffffff000 rwxp
7ffffffff000-800000000000 r-xp


Reply to: