Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] ntfs3: clear VMA_MAYWRITE on read-only compressed-file mmap
@ 2026-11-18 13:27 Abdifatah Suruur
  2026-11-23  7:15 ` [syzbot ci] " syzbot ci
  0 siblings, 1 reply; 2+ messages in thread
From: Abdifatah Suruur @ 2026-11-18 13:27 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: ntfs3, stable, Abdifatah Suruur

ntfs_file_mmap_prepare() rejects a writable mmap of compressed files,
but leaves VMA_MAYWRITE set in the VMA description. Userspace can map
such a file read-only and then upgrade the mapping with mprotect(),
writing page-cache pages of a compressed file even though the filesystem
explicitly does not support writable mmap for them.

Clear VMA_MAYWRITE on that path, so the restriction cannot be bypassed
after mmap().

Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>

---
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 1624f9b014e09..a817452ac73fa 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -415,6 +415,8 @@ static int ntfs_file_mmap_prepare(struct vm_area_desc *desc)
 		}
 		/* Turn off readahead for compressed files. */
 		file->f_ra.ra_pages = 0;
+		/* Do not allow mprotect() to make this mapping writable. */
+		vma_desc_clear_flags(desc, VMA_MAYWRITE_BIT);
 	}
 
 	if (rw) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 13:27 [PATCH] ntfs3: clear VMA_MAYWRITE on read-only compressed-file mmap Abdifatah Suruur
2026-11-23  7:15 ` [syzbot ci] " syzbot ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox