From af9f471b500bcd0c1023259c7577e074fe6d3ee5 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 20 Jun 2020 13:17:21 +0200 Subject: vm_map: Allow passing the name of a memory object as is returned by vm_info. * vm/vm_user.c (vm_map): Before trying to vm_object_enter, try to simply lookup the name. --- vm/vm_user.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vm/vm_user.c b/vm/vm_user.c index 92b1e494..f6fb1a41 100644 --- a/vm/vm_user.c +++ b/vm/vm_user.c @@ -345,14 +345,16 @@ kern_return_t vm_map( object = VM_OBJECT_NULL; offset = 0; copy = FALSE; - } else if ((object = vm_object_enter(memory_object, size, FALSE)) - == VM_OBJECT_NULL) + } else if ((object = vm_object_lookup_name (memory_object)) == VM_OBJECT_NULL && + (object = vm_object_enter(memory_object, size, FALSE)) == VM_OBJECT_NULL) { ipc_port_t real_memobj; vm_prot_t prot; + result = memory_object_proxy_lookup (memory_object, &real_memobj, &prot); if (result != KERN_SUCCESS) + /* Really no luck */ return result; /* Reduce the allowed access to the memory object. */ -- cgit v1.2.3