From: sashiko-bot@kernel.org
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: linux-usb@vger.kernel.org, linux-rdma@vger.kernel.org,
selinux@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v6 23/39] mm/mlock: clear VMA_LOCKED_MASK over mmap callback
Date: Tue, 13 Oct 2026 19:28:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-170388@kernel.org> (raw)
In-Reply-To: <20261013-b4-mmap-prepare-vma-flag-sanify-v6-23-1aa3c9b139f9@kernel.org>
> Currently there's a confusing mess around VMA_LOCKED_BIT and
> VMA_LOCKONFAULT_BIT.
>
> It is permitted for drivers to set any flags they like, with the VMA
> already possessing lock flags.
>
> This results in the absurd situation of a VMA possessing both
> VMA_SPECIAL_FLAGS and VMA_LOCKED_MASK flags, which is not permitted.
>
> This has resulted in mlock_vma_folio() having a very silly check for this
> scenario to work around it.
>
> There is no need for this - just clear the flags before invoking the hook
> and reinstate them afterwards if they are required.
>
> Nothing relies upon this being set during the mmap operation.
>
> mmap_prepare is unaffected by this so requires no fix.
>
> Reviewed-by: Zi Yan <ziy@nvidia.com>
> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-b4-mmap-prepare-vma-flag-sanify-v6-0-1aa3c9b139f9@kernel.org?part=23
next prev parent reply other threads:[~2026-10-13 19:28 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 15:04 [PATCH v6 00/39] mm: make VMA flag semantics explicit, eliminate VM_SPECIAL Lorenzo Stoakes (ARM)
2026-10-13 15:04 ` [PATCH v6 01/39] mm/vma: fix mmap_prepare file handling, remove file_doesnt_need_get Lorenzo Stoakes (ARM)
2026-10-13 15:34 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 02/39] mm/vma: introduce and use vma_[flags_]can_merge() Lorenzo Stoakes (ARM)
2026-10-13 15:19 ` David Hildenbrand (Arm)
2026-10-13 15:37 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 03/39] mm: consistently validate VMA state after mmap[_prepare] hooks Lorenzo Stoakes (ARM)
2026-10-13 15:51 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 04/39] mm/vma: ensure mmap_prepare doesn't set actions on a mergeable vma Lorenzo Stoakes (ARM)
2026-10-13 16:01 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 05/39] mm: make map_kernel_pages_[prepare,complete] internal and unexported Lorenzo Stoakes (ARM)
2026-10-13 16:04 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 06/39] mm/vma: tidy up map kernel pages enum values Lorenzo Stoakes (ARM)
2026-10-13 16:06 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 07/39] mm: assert mmap lock held, use new flags API in vm_insert_page[s] Lorenzo Stoakes (ARM)
2026-10-13 15:20 ` David Hildenbrand (Arm)
2026-10-13 16:14 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 08/39] mm: add mmap action for discontiguous kernel page mapping Lorenzo Stoakes (ARM)
2026-10-13 15:24 ` David Hildenbrand (Arm)
2026-10-13 16:29 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 09/39] docs: filesystems: update mmap_prepare docs for discontig kernel pgs Lorenzo Stoakes (ARM)
2026-10-13 15:25 ` David Hildenbrand (Arm)
2026-10-13 16:29 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 10/39] drivers/usb/mon: update to use mmap_prepare + map kernel pages Lorenzo Stoakes (ARM)
2026-10-13 16:44 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 11/39] infiniband: update hfi1 to use remap_vmalloc_range() Lorenzo Stoakes (ARM)
2026-10-13 17:04 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 12/39] selinux: reject writable opens of policy file, drop mmap shared/write check Lorenzo Stoakes (ARM)
2026-10-13 17:13 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 13/39] ALSA: pcm: use vm_insert_page() to map PCM status page Lorenzo Stoakes (ARM)
2026-10-13 17:33 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 14/39] bpf: arena: mark arena_map_mmap() mappings VM_MIXEDMAP Lorenzo Stoakes (ARM)
2026-10-13 17:47 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 15/39] mm/vma: add vma[_flags]_is_mm_managed() predicates Lorenzo Stoakes (ARM)
2026-10-13 17:50 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 16/39] mm/vma: only allow mmap to clear VMA_MAYWRITE_BIT if not mm-managed Lorenzo Stoakes (ARM)
2026-10-13 17:59 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 17/39] mm/vma: add and use vma_[flags]_is_fixed_mapping Lorenzo Stoakes (ARM)
2026-10-13 18:08 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 18/39] scsi: sg: convert mmap hook to mmap_prepare and rework Lorenzo Stoakes (ARM)
2026-10-13 18:25 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 19/39] fbdev: defio: assert FBINFO_VIRTFB, drop VM_IO, add VM_MIXEDMAP Lorenzo Stoakes (ARM)
2026-10-13 18:34 ` sashiko-bot
2026-10-13 15:05 ` [PATCH v6 20/39] HSI: cmt_speech: convert mmap hook to mmap_prepare, refactor Lorenzo Stoakes (ARM)
2026-10-13 18:48 ` sashiko-bot
2026-10-13 15:05 ` [PATCH v6 21/39] mm/gup: error out early on !VMA_MAYREAD_BIT VMAs Lorenzo Stoakes (ARM)
2026-10-13 19:03 ` sashiko-bot
2026-10-13 15:05 ` [PATCH v6 22/39] uprobes: remove VM_IO, set VM_MIXEDMAP for mapped kernel pages Lorenzo Stoakes (ARM)
2026-10-13 19:12 ` sashiko-bot
2026-10-13 15:05 ` [PATCH v6 23/39] mm/mlock: clear VMA_LOCKED_MASK over mmap callback Lorenzo Stoakes (ARM)
2026-10-13 19:28 ` sashiko-bot [this message]
2026-10-13 15:05 ` [PATCH v6 24/39] mm/mlock: eliminate weird VMA_IO_BIT abuse and simplify Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 25/39] mm/vma: enforce that mm-managed mappings may not set VMA_IO_BIT Lorenzo Stoakes (ARM)
2026-10-13 15:26 ` David Hildenbrand (Arm)
2026-10-13 15:05 ` [PATCH v6 26/39] mm: remove VMA_IO_BIT check in vma[_flags]_is_mm_managed() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 27/39] mm: remove hugetlb_inline.h Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 28/39] mm: rename is_vm_hugetlb_page() to vma_is_hugetlb() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 29/39] mm: drop some redundant checks around hugetlb VMAs Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 30/39] mm/vma: introduce vma[_flags]_is_mm_backed() Lorenzo Stoakes (ARM)
2026-10-13 15:31 ` David Hildenbrand (Arm)
2026-10-13 15:05 ` [PATCH v6 31/39] mm/madvise: update is_valid_guard_vma() to use vma_is_mm_backed() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 32/39] mm/uffd: use predicates for userfaultfd checks Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 33/39] mm/madvise: use predicates for madvise(..., MADV_DOFORK) Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 34/39] mm: eliminate VMA_SPECIAL_FLAGS usage when hugetlb explicitly tested Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 35/39] mm: eliminate VMA_SPECIAL_FLAGS check in lru_gen_look_around() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 36/39] mm: avoid use of VMA_SPECIAL_FLAGS in migrate_vma_setup() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 37/39] mm: eliminate VM_SPECIAL, VMA_SPECIAL_FLAGS Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 38/39] fuse: dax: do not set VM_MIXEDMAP Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 39/39] mm/huge_memory: remove vma_is_special_huge() Lorenzo Stoakes (ARM)
2026-10-13 18:50 ` [PATCH v6 00/39] mm: make VMA flag semantics explicit, eliminate VM_SPECIAL Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-170388@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox