Skip to content

Commit

Permalink
mm: _install_special_mapping() apply VM_LOCKED_CLEAR_MASK
Browse files Browse the repository at this point in the history
_install_special_mapping() adds the VM_SPECIAL bit VM_DONTEXPAND (and
never attempts to update locked_vm), so it ought to be consistent with
mmap_region() and mlock_fixup(), making sure not to add VM_LOCKED or
VM_LOCKONFAULT.  I doubt that this fixes any problem in practice: just
do it for consistency.

Link: https://lkml.kernel.org/r/a85315a9-21d1-6133-c5fc-c89863dfb25b@google.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Mar 22, 2022
1 parent f9871da commit 1fc0922
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3448,6 +3448,7 @@ static struct vm_area_struct *__install_special_mapping(
vma->vm_end = addr + len;

vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND | VM_SOFTDIRTY;
vma->vm_flags &= VM_LOCKED_CLEAR_MASK;
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);

vma->vm_ops = ops;
Expand Down

0 comments on commit 1fc0922

Please sign in to comment.