--- zzzz-none-000/linux-4.9.279/kernel/fork.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-arm-6591-750/linux-4.9.279/kernel/fork.c 2023-02-08 10:58:16.000000000 +0000 @@ -11,6 +11,11 @@ * management can be a bitch. See 'mm/memory.c': 'copy_page_range()' */ +/* + * Includes Intel Corporation's changes/modifications dated: 2017. + * Changed/modified portions - Copyright (c) 2017, Intel Corporation. + */ + #include #include #include @@ -624,8 +629,10 @@ tmp->vm_mm = mm; if (anon_vma_fork(tmp, mpnt)) goto fail_nomem_anon_vma_fork; - tmp->vm_flags &= - ~(VM_LOCKED|VM_LOCKONFAULT|VM_UFFD_MISSING|VM_UFFD_WP); + tmp->vm_flags &= ~(VM_UFFD_MISSING|VM_UFFD_WP); +#ifndef CONFIG_MLOCK_APPS + tmp->vm_flags &= ~(VM_LOCKED|VM_LOCKONFAULT); +#endif tmp->vm_next = tmp->vm_prev = NULL; tmp->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; file = tmp->vm_file; @@ -775,7 +782,9 @@ atomic_long_set(&mm->nr_ptes, 0); mm_nr_pmds_init(mm); mm->map_count = 0; +#ifndef CONFIG_MLOCK_APPS mm->locked_vm = 0; +#endif mm->pinned_vm = 0; memset(&mm->rss_stat, 0, sizeof(mm->rss_stat)); spin_lock_init(&mm->page_table_lock); @@ -793,6 +802,9 @@ if (current->mm) { mm->flags = current->mm->flags & MMF_INIT_MASK; mm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK; +#ifdef CONFIG_MLOCK_APPS + mm->def_flags |= current->mm->def_flags & VM_LOCKED; +#endif } else { mm->flags = default_dump_filter; mm->def_flags = 0;