freebsd-dev/libexec
Konstantin Belousov a3c8e04ef7 Currently, when mapping an object, rtld reserves the whole address space
for the mapping by the object' file with the protection and mode of
the first loadable segment over the whole region. Then, it maps other
segments at the appropriate addresses inside the region.

On amd64, due to default alignment of the segments being 1Gb, the
subsequent segment mappings leave the holes in the region, that usually
contain mapping of the object' file past eof. Such mappings prevent
wiring of the address space, because the pages cannot be faulted in.

Change the way the mapping of the ELF objects is constructed, by first
mapping PROT_NONE anonymous memory over the whole range, and then
mapping the segments of the object over it. Take advantage of this new
order and allocate .bss by changing the protection of the range instead
of remapping.

Note that we cannot simply keep the holes between segments, because
other mappings may be made there. Among other issues, when the dso is
unloaded, rtld unmaps the whole region, deleting unrelated mappings.

The kernel ELF image activator does put the holes between segments, but
this is not critical for now because kernel loads only executable image
and interpreter, both cannot be unloaded. This will be fixed later, if
needed.

Reported and tested by:	Hans Ottevanger <fbsdhackers beasties demon nl>
Suggested and reviewed by:	kan, alc
2009-04-10 10:14:04 +00:00
..
atrun Fixed static linkage (build with -DNO_SHARED). 2007-10-01 18:17:24 +00:00
bootpd Use RTF_LLDATA. 2009-03-31 23:02:51 +00:00
comsat Fix handling of pts(4) device names in comsat(8). Also catch fork() errors. 2009-01-17 15:56:38 +00:00
fingerd Mark functions as __dead2 in order to help the LLVM static checker 2008-08-04 01:25:48 +00:00
ftpd Move variable externs into extern.h so they are checked against the definitions. 2009-04-07 20:34:34 +00:00
getty Stop mentioning /usr/X11R6. 2007-07-24 06:41:07 +00:00
lukemftpd
mail.local
makekey
mknetid
pppoed Significantly reduce the memory leak as noted in BUGS section for 2007-07-04 00:00:41 +00:00
rbootd
revnetgroup
rlogind
rpc.rquotad Whitespace and style fixes, build at WARNS level 6. 2008-11-04 14:17:49 +00:00
rpc.rstatd Use sysctl to fetch stats from the kernel instead of reading variables 2008-06-10 18:47:43 +00:00
rpc.rusersd
rpc.rwalld
rpc.sprayd
rshd
rtld-aout
rtld-elf Currently, when mapping an object, rtld reserves the whole address space 2009-04-10 10:14:04 +00:00
save-entropy
smrsh
talkd Fix some "in in" typos in comments. 2008-03-26 07:32:08 +00:00
tcpd
telnetd Convert telnetd(8) to use posix_openpt(2). 2008-11-13 19:05:27 +00:00
tftp-proxy
tftpd Add "with" to make the line go smoother. 2007-11-23 01:52:44 +00:00
ypxfr
Makefile add new build knobs and jigger some existing controls to improve 2008-09-21 22:02:26 +00:00
Makefile.inc