summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
Diffstat (limited to 'vm')
-rw-r--r--vm/vm_init.c1
-rw-r--r--vm/vm_user.c23
2 files changed, 23 insertions, 1 deletions
diff --git a/vm/vm_init.c b/vm/vm_init.c
index 06317ac..f6a4060 100644
--- a/vm/vm_init.c
+++ b/vm/vm_init.c
@@ -82,4 +82,5 @@ void vm_mem_bootstrap()
void vm_mem_init()
{
vm_object_init();
+ memory_object_proxy_init();
}
diff --git a/vm/vm_user.c b/vm/vm_user.c
index 813b100..672daab 100644
--- a/vm/vm_user.c
+++ b/vm/vm_user.c
@@ -276,6 +276,12 @@ kern_return_t vm_copy(map, source_address, size, dest_address)
return KERN_SUCCESS;
}
+
+/* XXX From memory_object_proxy.c */
+kern_return_t
+memory_object_proxy_lookup (ipc_port_t proxy_object, ipc_port_t *object,
+ vm_prot_t *max_protection);
+
/*
* Routine: vm_map
*/
@@ -325,7 +331,22 @@ kern_return_t vm_map(
copy = FALSE;
} else if ((object = vm_object_enter(memory_object, size, FALSE))
== VM_OBJECT_NULL)
- return(KERN_INVALID_ARGUMENT);
+ {
+ ipc_port_t real_memobj;
+ vm_prot_t prot;
+ result = memory_object_proxy_lookup (memory_object, &real_memobj,
+ &prot);
+ if (result != KERN_SUCCESS)
+ return result;
+
+ /* Reduce the allowed access to the memory object. */
+ max_protection &= prot;
+ cur_protection &= prot;
+
+ if ((object = vm_object_enter(real_memobj, size, FALSE))
+ == VM_OBJECT_NULL)
+ return KERN_INVALID_ARGUMENT;
+ }
/*
* Perform the copy if requested