Date: Mon, 13 Mar 2017 10:49:37 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315194 - stable/11/sys/kern Message-ID: <201703131049.v2DAnbcl095060@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Mar 13 10:49:36 2017 New Revision: 315194 URL: https://svnweb.freebsd.org/changeset/base/315194 Log: Switch from the usage of vm_map_find()/vm_map_insert() to vm_map_fixed(). MFC r314487: Use vm_map_insert() instead of vm_map_find() in elf_map_insert(). MFC r314773: Instead of direct use of vm_map_insert(), call vm_map_fixed(MAP_CHECK_EXCL). Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Mon Mar 13 10:41:47 2017 (r315193) +++ stable/11/sys/kern/imgact_elf.c Mon Mar 13 10:49:36 2017 (r315194) @@ -397,10 +397,8 @@ __elfN(map_partial)(vm_map_t map, vm_obj /* * Create the page if it doesn't exist yet. Ignore errors. */ - vm_map_lock(map); - vm_map_insert(map, NULL, 0, trunc_page(start), round_page(end), - VM_PROT_ALL, VM_PROT_ALL, 0); - vm_map_unlock(map); + vm_map_fixed(map, NULL, 0, trunc_page(start), round_page(end) - + trunc_page(start), VM_PROT_ALL, VM_PROT_ALL, MAP_CHECK_EXCL); /* * Find the page from the underlying object. @@ -451,9 +449,8 @@ __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); + rv = vm_map_fixed(map, NULL, 0, start, end - start, + prot | VM_PROT_WRITE, VM_PROT_ALL, MAP_CHECK_EXCL); if (rv != KERN_SUCCESS) return (rv); if (object == NULL) @@ -476,10 +473,9 @@ __elfN(map_insert)(struct image_params * rv = KERN_SUCCESS; } else { vm_object_reference(object); - vm_map_lock(map); - rv = vm_map_insert(map, object, offset, start, end, - prot, VM_PROT_ALL, cow); - vm_map_unlock(map); + rv = vm_map_fixed(map, object, offset, start, + end - start, prot, VM_PROT_ALL, + cow | MAP_CHECK_EXCL); if (rv != KERN_SUCCESS) { locked = VOP_ISLOCKED(imgp->vp); VOP_UNLOCK(imgp->vp, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703131049.v2DAnbcl095060>