From: Nirbhay Sharma <nirbhay.lkd@gmail.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: david.hunter.linux@gmail.com, skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org,
khalid@kernel.org,
syzbot+83c9dd5c0dcf6184fdbf@syzkaller.appspotmail.com,
ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/ntfs3: fix KMSAN uninit-value in ni_create_attr_list
Date: Sat, 25 Oct 2025 20:37:07 +0530 [thread overview]
Message-ID: <4aeceb66-ceea-4171-8806-95bd11a928b3@gmail.com> (raw)
In-Reply-To: <20251006223805.139206-1-nirbhay.lkd@gmail.com>
On 10/7/25 4:08 AM, Nirbhay Sharma wrote:
> The call to kmalloc() to allocate the attribute list buffer is given a
> size of al_aligned(rs). This size can be larger than the data
> subsequently copied into the buffer, leaving trailing bytes uninitialized.
>
> This can trigger a KMSAN "uninit-value" warning if that memory is
> later accessed.
>
> Fix this by using kzalloc() instead, which ensures the entire
> allocated buffer is zero-initialized, preventing the warning.
>
> Reported-by: syzbot+83c9dd5c0dcf6184fdbf@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=83c9dd5c0dcf6184fdbf
> Signed-off-by: Nirbhay Sharma <nirbhay.lkd@gmail.com>
> ---
> The following syzbot test commands were used to verify the fix against
> both linux-next and a specific mainline commit. Both kernels were
> configured with CONFIG_KMSAN=y, and no KMSAN warnings were observed
> with the patch applied.
>
> An attempt to test against the latest mainline tip failed due to an
> unrelated boot failure in the SCSI subsystem (KMSAN: use-after-free in
> scsi_get_vpd_buf). Therefore, testing was done on the last known-good
> mainline commit below.
>
> For mainline commit 9b0d551bcc05 ("Merge tag 'pull-misc' of..."):
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 9b0d551bcc05
>
> For the linux-next branch:
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>
> fs/ntfs3/frecord.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
> index 8f9fe1d7a690..4fe8da7fc034 100644
> --- a/fs/ntfs3/frecord.c
> +++ b/fs/ntfs3/frecord.c
> @@ -767,7 +767,7 @@ int ni_create_attr_list(struct ntfs_inode *ni)
> * Skip estimating exact memory requirement.
> * Looks like one record_size is always enough.
> */
> - le = kmalloc(al_aligned(rs), GFP_NOFS);
> + le = kzalloc(al_aligned(rs), GFP_NOFS);
> if (!le)
> return -ENOMEM;
>
Hi Konstantin,
I sent this patch about 3 weeks ago and haven't heard back yet. I wanted
to check if there are any concerns with the patch or if any changes are
needed. The fix addresses a KMSAN uninit-value bug and has been tested
successfully on both linux-next and the commit from the syzbot report.
Please let me know if you need any additional information or testing.
Thanks,
Nirbhay
next prev parent reply other threads:[~2025-10-25 15:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 22:38 [PATCH] fs/ntfs3: fix KMSAN uninit-value in ni_create_attr_list Nirbhay Sharma
2025-10-07 0:47 ` [syzbot] [ntfs3?] KMSAN: uninit-value in attr_set_size syzbot
2025-10-25 15:07 ` Nirbhay Sharma [this message]
2025-10-27 10:24 ` [PATCH] fs/ntfs3: fix KMSAN uninit-value in ni_create_attr_list Konstantin Komarov
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=4aeceb66-ceea-4171-8806-95bd11a928b3@gmail.com \
--to=nirbhay.lkd@gmail.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=david.hunter.linux@gmail.com \
--cc=khalid@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+83c9dd5c0dcf6184fdbf@syzkaller.appspotmail.com \
/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