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

* [syzbot ci] Re: ntfs3: clear VMA_MAYWRITE on read-only compressed-file mmap
  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
  0 siblings, 0 replies; 2+ messages in thread
From: syzbot ci @ 2026-11-23  7:15 UTC (permalink / raw)
  To: almaz.alexandrovich, ntfs3, stable, suruurism; +Cc: syzbot, syzkaller-bugs

syzbot ci has tested the following series

[v1] ntfs3: clear VMA_MAYWRITE on read-only compressed-file mmap
https://lore.kernel.org/all/20261118132710.29751-1-suruurism@gmail.com
* [PATCH] ntfs3: clear VMA_MAYWRITE on read-only compressed-file mmap

and found the following issue:
WARNING in mmap_validate

Full report is available here:
https://ci.syzbot.org/series/2cf8a8c7-bfcc-4bcc-bfda-dccd333a025d

***

WARNING in mmap_validate

tree:      torvalds
URL:       https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
base:      b3f1631d362539cfe14571ccfd7db919ffbc08c7
arch:      amd64
compiler:  Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
config:    https://ci.syzbot.org/builds/92ccdff0-04ed-4a0e-80d7-77102143beb7/config
syz repro: https://ci.syzbot.org/findings/189d2e19-2002-455d-a0ed-c3a015048eaa/syz_repro

loop0: detected capacity change from 0 to 4096
ntfs3(loop0): Failed to load $Extend (-22).
ntfs3(loop0): Failed to initialize $Extend.
------------[ cut here ]------------
was_maywrite && !is_maywrite
WARNING: mm/vma.c:2872 at mmap_validate+0x1c3/0x1e0 mm/vma.c:2872, CPU#1: syz.0.17/5893
Modules linked in:
CPU: 1 UID: 0 PID: 5893 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:mmap_validate+0x1c3/0x1e0 mm/vma.c:2872
Code: 5c 41 5d 41 5e 41 5f 5d e9 1a 34 d8 09 cc e8 e4 8a 98 ff 90 0f 0b 90 eb 1f e8 d9 8a 98 ff 90 0f 0b 90 eb 14 e8 ce 8a 98 ff 90 <0f> 0b 90 eb 09 e8 c3 8a 98 ff 90 0f 0b 90 41 be ea ff ff ff eb bb
RSP: 0018:ffffc900041ef428 EFLAGS: 00010293
RAX: ffffffff82309662 RBX: ffffc900041ef9a0 RCX: ffff8881686c3c00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000200000000001 R08: ffffc900041ef9a7 R09: 1ffff9200083df34
R10: dffffc0000000000 R11: fffff5200083df35 R12: dffffc0000000000
R13: 1ffff9200083df34 R14: 0000000000000001 R15: 0000000000000001
FS:  00007fb956e196c0(0000) GS:ffff8882a7809000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb955e71a20 CR3: 00000001baeae000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 call_mmap_prepare mm/vma.c:2975 [inline]
 __mmap_region mm/vma.c:3075 [inline]
 mmap_region+0x12d8/0x2800 mm/vma.c:3173
 do_mmap+0xe0a/0x1300 mm/mmap.c:573
 vm_mmap_pgoff+0x27a/0x520 mm/util.c:581
 ksys_mmap_pgoff+0x4dc/0x760 mm/mmap.c:619
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb955fa8fd9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fb956e19028 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007fb956225fa0 RCX: 00007fb955fa8fd9
RDX: 0000000000000001 RSI: 0000000000400000 RDI: 0000200000000000
RBP: 00007fb956037fed R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000010012 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fb956226038 R14: 00007fb956225fa0 R15: 00007ffcdbaed6f8
 </TASK>


***

If these findings have caused you to resend the series or submit a
separate fix, please add the following tag to your commit message:
  Tested-by: syzbot@syzkaller.appspotmail.com

---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.

^ permalink raw reply	[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