From: syzbot <syzbot+08d8956768c96a2c52cf@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [PATCH] fs/ntfs3: Fix KMSAN warning in longest_match_std()
Date: Tue, 28 Jan 2025 21:28:38 -0800 [thread overview]
Message-ID: <6799bc86.050a0220.ac840.02c4.GAE@google.com> (raw)
In-Reply-To: <0000000000001a0a38060e875458@google.com>
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
next prev parent reply other threads:[~2025-01-29 5:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 18:17 [syzbot] [ntfs3?] KMSAN: uninit-value in longest_match_std (2) syzbot
2025-01-29 5:28 ` syzbot [this message]
2025-11-19 14:24 ` Forwarded: " syzbot
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=6799bc86.050a0220.ac840.02c4.GAE@google.com \
--to=syzbot+08d8956768c96a2c52cf@syzkaller.appspotmail.com \
--cc=linux-kernel@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