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

Re: shared memory load address and gcl



Greetings!  GCL, like many lisp systems, manages memory via appending
pages to its .data section with sbrk as needed.  GCL performs at
configuration time various checks to determine how many pages can be
thus added before running into some other obstacle, usually the shared
memory load address base.  On x86 linux, this is at 0x40000000.  In
addition, gcl attempts to craft a linker script to lower its .text
section down to 0 to make more room if needed.

My understanding is that these addresses are not configurable by the
user.  I would so love to be shown that this is incorrect.  In any
case, assuming this is the case, on debian bsd amd64, the porter box
(asdfasdf, with broken gdb by the way), loads ld.so at a very low load
address of ~ 0x1000000, but then other libs at the higher
0x800000000.  Small test programs have sbrk start beneath the former,
while larger programs have sbrk start in the gap between the
addresses.  There is more than enough space in the latter area, but
not the former, for gcl.  The buildd apparently starts at 0x20000000
even for small programs.  On this machine, the linker script lowering
of the .text address to 0 works, on asdfasdf it aborts, presumably
because of the low ld.so address.

1) Are any of these addresses configurable by the user?
2) Why are they different on these machines?  Are they standards of
the kernel, or intended to be so?
3) Do I need to plan to work around possible gaps in this area, as is
the case presently with asdfasdf?  This is the only machine I've ever
used with such a gap.


The address for binary can given by linker script.
The address for shared object, including ld.so is given by kernel.
It is somehow calculated from ulimit's of process.

The mapping is different between i386 and x86_64.
The mapping is different when executable is started normally
and when via ld.so. The starting brk position is also different
- it depends what have been the primary ELF object.

The mapping is not exactly same under 7.2 (buildd so far)
and 8.0 kernels (asdfasdf).

Petr

$ uname -a
GNU/kFreeBSD asdfasdf 8.0-1-amd64 #0 Thu Nov 26 04:22:59 CET 2009 x86_64 amd64 AMD Sempron(tm) Processor 3000+ GNU/kFreeBSD

salinger@asdfasdf:~$  /lib/ld-2.10.2.so /bin/cat /proc/self/maps
00400000-0040a000 r-xp 0000b000 00:00 8784913     /bin/cat
0060a000-0060b000 rw-p 0000b000 00:00 8784913     /bin/cat
01021000-0103e000 r-xp 00020000 00:00 6217746     /lib/ld-2.10.2.so
0123e000-0123f000 r--p 00020000 00:00 6217746     /lib/ld-2.10.2.so
0123f000-01240000 rw-p 00001000 00:00 0
80123e000-801241000 rw-p 00003000 00:00 0
801241000-801253000 r--p 00012000 00:00 6359257     /etc/ld.so.cache
801253000-801389000 r-xp 0013f000 00:00 6217827     /lib/libc-2.10.2.so
801389000-801589000 ---p 0013f000 00:00 6217827     /lib/libc-2.10.2.so
801589000-80158d000 r--p 0013f000 00:00 6217827     /lib/libc-2.10.2.so
80158d000-80158f000 rw-p 0013f000 00:00 6217827     /lib/libc-2.10.2.so
80158f000-801694000 rw-p 00105000 00:00 0
7ffffffe0000-800000000000 rwxp 00020000 00:00 0


salinger@asdfasdf:~$ cat /proc/self/maps
00400000-0040a000 r-xp 0000b000 00:00 8784913     /bin/cat
0060a000-0062c000 rw-p 00022000 00:00 0
80060a000-800627000 r-xp 00020000 00:00 6217746     /lib/ld-2.10.2.so
800627000-80062a000 rw-p 00003000 00:00 0
80062a000-80063c000 r--p 00012000 00:00 6359257     /etc/ld.so.cache
80063c000-80063d000 rw-p 00001000 00:00 0
800827000-800828000 r--p 00020000 00:00 6217746     /lib/ld-2.10.2.so
800828000-800829000 rw-p 00001000 00:00 0
800829000-80095f000 r-xp 0013f000 00:00 6217827     /lib/libc-2.10.2.so
80095f000-800b5f000 ---p 0013f000 00:00 6217827     /lib/libc-2.10.2.so
800b5f000-800b63000 r--p 0013f000 00:00 6217827     /lib/libc-2.10.2.so
800b63000-800b65000 rw-p 0013f000 00:00 6217827     /lib/libc-2.10.2.so
800b65000-800b69000 rw-p 00004000 00:00 0
7ffffffe0000-800000000000 rwxp 00020000 00:00 0


GNU/kFreeBSD io.debian.net 7.2-1-686 #0 Tue Oct  6 16:51:07 CEST 2009 i686 i386 AMD Sempron(tm) Processor 2600+ GNU/kFreeBSD
salinger@io:~$ /lib/ld-2.10.2.so /bin/cat /proc/self/maps
08048000-08051000 r-xp 00009000 00:00 1507351     /bin/cat
08051000-08052000 rwxp 00009000 00:00 1507351     /bin/cat
20000000-2001b000 r-xp 0001c000 00:00 5699606     /lib/ld-2.10.2.so
2001b000-2001c000 r-xp 0001c000 00:00 5699606     /lib/ld-2.10.2.so
2001c000-2001d000 rw-p 00001000 00:00 0
4001b000-4001d000 rwxp 00002000 00:00 0
4001d000-40035000 r-xp 00018000 00:00 7748723     /etc/ld.so.cache
40035000-40158000 r-xp 00129000 00:00 5699803     /lib/i686/cmov/libc-2.10.2.so
40158000-4015a000 r-xp 00129000 00:00 5699803     /lib/i686/cmov/libc-2.10.2.so
4015a000-4015b000 rwxp 00129000 00:00 5699803     /lib/i686/cmov/libc-2.10.2.so
4015b000-4025f000 rwxp 00104000 00:00 0
bfbe0000-bfc00000 rwxp 00020000 00:00 0

salinger@io:~$ cat /proc/self/maps
08048000-08051000 r-xp 00009000 00:00 1507351     /bin/cat
08051000-08052000 rw-p 00022000 00:00 0
08052000-08073000 rwxp 00022000 00:00 0
28051000-2806c000 r-xp 0001c000 00:00 5699606     /lib/ld-2.10.2.so
2806c000-2806d000 r-xp 0001c000 00:00 5699606     /lib/ld-2.10.2.so
2806d000-2806e000 rw-p 00003000 00:00 0
2806e000-28070000 rwxp 00003000 00:00 0
28070000-28088000 r-xp 00018000 00:00 7748723     /etc/ld.so.cache
28088000-281ab000 r-xp 00129000 00:00 5699803     /lib/i686/cmov/libc-2.10.2.so
281ab000-281ad000 r-xp 00129000 00:00 5699803     /lib/i686/cmov/libc-2.10.2.so
281ad000-281ae000 rwxp 00129000 00:00 5699803     /lib/i686/cmov/libc-2.10.2.so
281ae000-281b2000 rwxp 00004000 00:00 0
bfbe0000-bfc00000 rwxp 00020000 00:00 0


Reply to: