]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/mach/mach_vm.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / libsyscall / mach / mach_vm.c
index f8fbf921dee843f783b7fe3f3bf991093546c535..365d9a94bc5af08661ea8b0108dd8f356abec4f0 100644 (file)
@@ -58,8 +58,8 @@ mach_vm_allocate(
                rv = _kernelrpc_mach_vm_allocate(target, address, size, flags);
        }
 
-       if (__syscall_logger && rv == KERN_SUCCESS && !(flags & VM_MAKE_TAG(VM_MEMORY_STACK))) {
-               int userTagFlags = flags & VM_FLAGS_ALIAS_MASK;
+       int userTagFlags = flags & VM_FLAGS_ALIAS_MASK;
+       if (__syscall_logger && rv == KERN_SUCCESS && (userTagFlags != VM_MAKE_TAG(VM_MEMORY_STACK))) {
                __syscall_logger(stack_logging_type_vm_allocate | userTagFlags, (uintptr_t)target, (uintptr_t)size, 0, (uintptr_t)*address, 0);
        }
 
@@ -184,9 +184,9 @@ mach_vm_map(
                    offset, copy, cur_protection, max_protection, inheritance);
        }
 
-       if (__syscall_logger && rv == KERN_SUCCESS && !(flags & VM_MAKE_TAG(VM_MEMORY_STACK))) {
+       int userTagFlags = flags & VM_FLAGS_ALIAS_MASK;
+       if (__syscall_logger && rv == KERN_SUCCESS && (userTagFlags != VM_MAKE_TAG(VM_MEMORY_STACK))) {
                int eventTypeFlags = stack_logging_type_vm_allocate | stack_logging_type_mapped_file_or_shared_mem;
-               int userTagFlags = flags & VM_FLAGS_ALIAS_MASK;
                __syscall_logger(eventTypeFlags | userTagFlags, (uintptr_t)target, (uintptr_t)size, 0, (uintptr_t)*address, 0);
        }
 
@@ -222,6 +222,36 @@ mach_vm_remap(
        return rv;
 }
 
+kern_return_t
+mach_vm_remap_new(
+       mach_port_name_t target,
+       mach_vm_address_t *address,
+       mach_vm_size_t size,
+       mach_vm_offset_t mask,
+       int flags,
+       mach_port_name_t src_task,
+       mach_vm_address_t src_address,
+       boolean_t copy,
+       vm_prot_t *cur_protection,
+       vm_prot_t *max_protection,
+       vm_inherit_t inheritance)
+{
+       kern_return_t rv;
+
+       /* {max,cur}_protection is inout */
+       rv = _kernelrpc_mach_vm_remap_new(target, address, size, mask, flags,
+           src_task, src_address, copy, cur_protection, max_protection,
+           inheritance);
+
+       if (__syscall_logger && rv == KERN_SUCCESS) {
+               int eventTypeFlags = stack_logging_type_vm_allocate | stack_logging_type_mapped_file_or_shared_mem;
+               int userTagFlags = flags & VM_FLAGS_ALIAS_MASK;
+               __syscall_logger(eventTypeFlags | userTagFlags, (uintptr_t)target, (uintptr_t)size, 0, (uintptr_t)*address, 0);
+       }
+
+       return rv;
+}
+
 kern_return_t
 mach_vm_read(
        mach_port_name_t target,
@@ -301,6 +331,36 @@ vm_remap(
        return rv;
 }
 
+kern_return_t
+vm_remap_new(
+       mach_port_name_t target,
+       vm_address_t *address,
+       vm_size_t size,
+       vm_offset_t mask,
+       int flags,
+       mach_port_name_t src_task,
+       vm_address_t src_address,
+       boolean_t copy,
+       vm_prot_t *cur_protection,
+       vm_prot_t *max_protection,
+       vm_inherit_t inheritance)
+{
+       kern_return_t rv;
+
+       /* {max,cur}_protection is inout */
+       rv = _kernelrpc_vm_remap_new(target, address, size, mask, flags,
+           src_task, src_address, copy, cur_protection, max_protection,
+           inheritance);
+
+       if (__syscall_logger) {
+               int eventTypeFlags = stack_logging_type_vm_allocate | stack_logging_type_mapped_file_or_shared_mem;
+               int userTagFlags = flags & VM_FLAGS_ALIAS_MASK;
+               __syscall_logger(eventTypeFlags | userTagFlags, (uintptr_t)target, (uintptr_t)size, 0, (uintptr_t)*address, 0);
+       }
+
+       return rv;
+}
+
 kern_return_t
 vm_read(
        mach_port_name_t target,