* [to-be-updated] mm-consistently-validate-vma-state-after-mmap-hooks-fix.patch removed from -mm tree
@ 2026-10-10 21:39 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-10-10 21:39 UTC (permalink / raw)
To: mm-commits, okerixx, akpm
The quilt patch titled
Subject: mm/vma: keep the unlinked VMA off the file across unmap on mmap hook failure
has been removed from the -mm tree. Its filename was
mm-consistently-validate-vma-state-after-mmap-hooks-fix.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Oleg Keri <okerixx@gmail.com>
Subject: mm/vma: keep the unlinked VMA off the file across unmap on mmap hook failure
Date: Wed, 7 Oct 2026 21:47:08 +0200
Since commit 2ceb21171dd9 ("mm: consistently validate VMA state after
mmap[_prepare] hooks"), the mmap error path clears vma->vm_file only
after unmap_region(), so free_pgtables() unlinks the never-linked VMA
and drops i_mmap_writable. Once it goes negative, every later shared
writable mmap of that file fails with -EPERM until reboot.
Clear vm_file across unmap_region() only, so that free_pgtables() does
not unlink a VMA that was never linked to the file, and restore it for
vma_close(): when the hook succeeded and the validation failed, the
driver's close() still runs and may use vma->vm_file.
Link: https://lore.kernel.org/20261007194708.2009-1-okerixx@gmail.com
Fixes: 2ceb21171dd9 ("mm: consistently validate VMA state after mmap[_prepare] hooks")
Signed-off-by: Oleg Keri <okerixx@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Bert Karwatzki <spasswolf@web.de>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
---
mm/vma.c | 3 +++
1 file changed, 3 insertions(+)
--- a/mm/vma.c~mm-consistently-validate-vma-state-after-mmap-hooks-fix
+++ a/mm/vma.c
@@ -2626,12 +2626,15 @@ static int __mmap_new_file_vma(struct mm
map->vm_file = vma->vm_file;
if (error) {
+ struct file *file = vma->vm_file;
UNMAP_STATE(unmap, vmi, vma, vma->vm_start, vma->vm_end,
map->prev, map->next);
+ vma->vm_file = NULL;
vma_iter_set(vmi, vma->vm_end);
/* Undo any partial mapping done by a device driver. */
unmap_region(&unmap);
+ vma->vm_file = file;
/* Only safe once unmapped. */
vma_close(vma);
_
Patches currently in -mm which might be from okerixx@gmail.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-10 21:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-10 21:39 [to-be-updated] mm-consistently-validate-vma-state-after-mmap-hooks-fix.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.