svn commit: r315194 - stable/11/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Mon Mar 13 10:49:38 UTC 2017
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);
More information about the svn-src-all
mailing list