From: Abdifatah Suruur <suruurism@gmail.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: ntfs3@lists.linux.dev, stable@vger.kernel.org,
Abdifatah Suruur <suruurism@gmail.com>
Subject: [PATCH] ntfs3: clear VMA_MAYWRITE on read-only compressed-file mmap
Date: Wed, 18 Nov 2026 16:27:10 +0300 [thread overview]
Message-ID: <20261118132710.29751-1-suruurism@gmail.com> (raw)
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) {
next reply other threads:[~2026-11-18 13:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 13:27 Abdifatah Suruur [this message]
2026-11-23 7:15 ` [syzbot ci] Re: ntfs3: clear VMA_MAYWRITE on read-only compressed-file mmap syzbot ci
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=20261118132710.29751-1-suruurism@gmail.com \
--to=suruurism@gmail.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=ntfs3@lists.linux.dev \
--cc=stable@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