Date: Fri, 10 Apr 2009 10:14:04 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/libexec/rtld-elf map_object.c Message-ID: <200904101014.n3AAEIYh007233@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
kib 2009-04-10 10:14:04 UTC FreeBSD src repository Modified files: libexec/rtld-elf map_object.c Log: SVN rev 190885 on 2009-04-10 10:14:04Z by kib 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 Revision Changes Path 1.21 +5 -7 src/libexec/rtld-elf/map_object.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904101014.n3AAEIYh007233>