Author: kib Date: Wed Mar 1 10:28:15 2017 New Revision: 314487 URL: https://svnweb.freebsd.org/changeset/base/314487
Log: Use vm_map_insert() instead of vm_map_find() in elf_map_insert(). Elf_map_insert() needs to create mapping at the known fixed address. Usage of vm_map_find() assumes, on the other hand, that any suitable address space range above or equal the specified hint, is acceptable. Due to operating on the fresh or cleared address space, vm_map_find() usually creates mapping starting exactly at hint. Switch to vm_map_insert() use to clearly request fixed mapping from the VM. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Wed Mar 1 10:22:07 2017 (r314486) +++ head/sys/kern/imgact_elf.c Wed Mar 1 10:28:15 2017 (r314487) @@ -452,9 +452,10 @@ __elfN(map_insert)(struct image_params * * The mapping is not page aligned. This means we have * to copy the data. Sigh. */ - rv = vm_map_find(map, NULL, 0, &start, end - start, 0, - VMFS_NO_SPACE, prot | VM_PROT_WRITE, VM_PROT_ALL, - 0); + vm_map_lock(map); + rv = vm_map_insert(map, NULL, 0, start, end, + prot | VM_PROT_WRITE, VM_PROT_ALL, 0); + vm_map_unlock(map); if (rv != KERN_SUCCESS) return (rv); if (object == NULL) _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"