public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [ntfs3?] KMSAN: uninit-value in longest_match_std (2)
@ 2024-01-09 18:17 syzbot
  2025-01-29  5:28 ` [syzbot] [PATCH] fs/ntfs3: Fix KMSAN warning in longest_match_std() syzbot
  2025-11-19 14:24 ` Forwarded: Re: KMSAN: uninit-value in longest_match_std (2) syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2024-01-09 18:17 UTC (permalink / raw)
  To: almaz.alexandrovich, linux-fsdevel, linux-kernel, ntfs3,
	syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    610a9b8f49fb Linux 6.7-rc8
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=11a0f711e80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e51fe20c3e51ba7f
dashboard link: https://syzkaller.appspot.com/bug?extid=08d8956768c96a2c52cf
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=141f845ee80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1413cf11e80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/28ecdd56de1e/disk-610a9b8f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3c5afc17c174/vmlinux-610a9b8f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/96ff79b2992d/bzImage-610a9b8f.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/689e00cd89ff/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+08d8956768c96a2c52cf@syzkaller.appspotmail.com

ntfs3: loop0: Failed to initialize $Extend/$ObjId.
=====================================================
BUG: KMSAN: uninit-value in longest_match_std+0x5d9/0xe00 fs/ntfs3/lznt.c:60
 longest_match_std+0x5d9/0xe00 fs/ntfs3/lznt.c:60
 compress_chunk fs/ntfs3/lznt.c:170 [inline]
 compress_lznt+0x41b/0xef0 fs/ntfs3/lznt.c:336
 ni_write_frame+0xf89/0x1c80 fs/ntfs3/frecord.c:2839
 ntfs_compress_write+0x2521/0x3b70 fs/ntfs3/file.c:995
 ntfs_file_write_iter+0x89b/0xd30 fs/ntfs3/file.c:1081
 call_write_iter include/linux/fs.h:2020 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x8ef/0x1490 fs/read_write.c:584
 ksys_write+0x20f/0x4c0 fs/read_write.c:637
 __do_sys_write fs/read_write.c:649 [inline]
 __se_sys_write fs/read_write.c:646 [inline]
 __x64_sys_write+0x93/0xd0 fs/read_write.c:646
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Uninit was created at:
 __alloc_pages+0x9a4/0xe00 mm/page_alloc.c:4591
 alloc_pages_mpol+0x62b/0x9d0 mm/mempolicy.c:2133
 alloc_pages mm/mempolicy.c:2204 [inline]
 folio_alloc+0x1da/0x380 mm/mempolicy.c:2211
 filemap_alloc_folio+0xa5/0x430 mm/filemap.c:974
 __filemap_get_folio+0xa5a/0x1760 mm/filemap.c:1918
 pagecache_get_page+0x4a/0x1a0 mm/folio-compat.c:99
 find_or_create_page include/linux/pagemap.h:740 [inline]
 ntfs_get_frame_pages+0xdc/0x9f0 fs/ntfs3/file.c:794
 ntfs_compress_write+0x1b0b/0x3b70 fs/ntfs3/file.c:944
 ntfs_file_write_iter+0x89b/0xd30 fs/ntfs3/file.c:1081
 call_write_iter include/linux/fs.h:2020 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x8ef/0x1490 fs/read_write.c:584
 ksys_write+0x20f/0x4c0 fs/read_write.c:637
 __do_sys_write fs/read_write.c:649 [inline]
 __se_sys_write fs/read_write.c:646 [inline]
 __x64_sys_write+0x93/0xd0 fs/read_write.c:646
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

CPU: 0 PID: 4999 Comm: syz-executor227 Not tainted 6.7.0-rc8-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
=====================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

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

* Re: [syzbot] [PATCH] fs/ntfs3: Fix KMSAN warning in longest_match_std()
  2024-01-09 18:17 [syzbot] [ntfs3?] KMSAN: uninit-value in longest_match_std (2) syzbot
@ 2025-01-29  5:28 ` syzbot
  2025-11-19 14:24 ` Forwarded: Re: KMSAN: uninit-value in longest_match_std (2) syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2025-01-29  5:28 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] fs/ntfs3: Fix KMSAN warning in longest_match_std()
Author: gauthamgujjula@gmail.com

#syz test

Syzkaller reported uninitialized memory in longest_match_std(),
originating from ntfs_compress_write(). In the case where a frame's
pages are not up to date, but that frame is not read in due to the
overlapping bounds of the write, the end of the frame will remain
uninitialized if the user data copied in is not frame-aligned.

To init the memory without invoking ni_read_frame() in cases where the
data will be overwritten anyways, add an additional clause to zero out
the section of the frame from the end of the user's data to the end of
the frame.

Reported-by: syzbot+08d8956768c96a2c52cf@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=08d8956768c96a2c52cf
Signed-off-by: Gautham Gujjula <gauthamgujjula@gmail.com>
---
 fs/ntfs3/file.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index fad68ff0b6ed..6fc4f960f4d9 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -1122,6 +1122,13 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
 					}
 					goto out;
 				}
+			} else if (to & (frame_size - 1)) {
+				for (ip = to >> PAGE_SHIFT, off = offset_in_page(to);
+				     ip < pages_per_frame;
+				     ip++, off = 0) {
+					zero_user_segment(pages[ip], off, PAGE_SIZE);
+					flush_dcache_page(pages[ip]);
+				}
 			}
 		}
 
-- 
2.45.3


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

* Forwarded: Re: KMSAN: uninit-value in longest_match_std (2)
  2024-01-09 18:17 [syzbot] [ntfs3?] KMSAN: uninit-value in longest_match_std (2) syzbot
  2025-01-29  5:28 ` [syzbot] [PATCH] fs/ntfs3: Fix KMSAN warning in longest_match_std() syzbot
@ 2025-11-19 14:24 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2025-11-19 14:24 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: KMSAN: uninit-value in longest_match_std (2)
Author: kubik.bartlomiej@gmail.com

#syz test

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

end of thread, other threads:[~2025-11-19 14:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-09 18:17 [syzbot] [ntfs3?] KMSAN: uninit-value in longest_match_std (2) syzbot
2025-01-29  5:28 ` [syzbot] [PATCH] fs/ntfs3: Fix KMSAN warning in longest_match_std() syzbot
2025-11-19 14:24 ` Forwarded: Re: KMSAN: uninit-value in longest_match_std (2) syzbot

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