On Wed, Jun 13, 2012 at 2:12 PM, Konstantin Belousov <kostik...@gmail.com>wrote:
> On Wed, Jun 13, 2012 at 07:14:09AM -0600, Ian Lepore wrote: > > http://lists.freebsd.org/pipermail/freebsd-arm/2012-January/003288.html > > The map_object.c patch is step in the almost right direction, I wanted > to remove the static page-sized buffer from get_elf_header for long time. > It works because rtld always holds bind_lock exclusively while loading > an object. There is no need to copy the first page after it is mapped. > > commit 0f6f8629af1345acded7c0c685d3ff7b4d9180d6 > Author: Konstantin Belousov <k...@freebsd.org> > Date: Wed Jun 13 22:04:18 2012 +0300 > > Eliminate the static buffer used to read the first page of the mapped > object, and eliminate the pread(2) call as well. Mmap the first page > of the object temporaly, and unmap it on error or last use. > > Fix several cases were the whole mapping of the object leaked on error. > > Potentially, this leaves one-page gap between succeeding dlopen(3), > but there are other mmap(2) consumers as well. > > I suggest adding MAP_PREFAULT_READ to the mmap(2) call. A heuristic in vm_map_pmap_enter() would trigger automatic mapping for small files, but if the object file is larger than 96 pages then you need to explicitly specific MAP_PREFAULT_READ. Alan _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"