mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "glaubitz@physik.fu-berlin.de" <glaubitz@physik.fu-berlin.de>,
	"frank.li@vivo.com" <frank.li@vivo.com>,
	"slava@dubeyko.com" <slava@dubeyko.com>,
	"kartikey406@gmail.com" <kartikey406@gmail.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"syzbot+d80abb5b890d39261e72@syzkaller.appspotmail.com"
	<syzbot+d80abb5b890d39261e72@syzkaller.appspotmail.com>
Subject: Re:  [PATCH v2] hfsplus: fix uninit-value in hfsplus_strcasecmp
Date: Wed, 21 Jan 2026 20:14:27 +0000	[thread overview]
Message-ID: <5b3c275b93ba5df4bdb42dc2a5342ebe63782337.camel@ibm.com> (raw)
In-Reply-To: <20260121063109.1830263-1-kartikey406@gmail.com>

On Wed, 2026-01-21 at 12:01 +0530, Deepanshu Kartikey wrote:
> Syzbot reported a KMSAN uninit-value issue in hfsplus_strcasecmp() during
> filesystem mount operations. The root cause is that hfsplus_find_cat()
> declares a local hfsplus_cat_entry variable without initialization before
> passing it to hfs_brec_read().
> 
> When the filesystem image is corrupted or malformed (as syzbot fuzzes),
> hfs_brec_read() may read less data than sizeof(hfsplus_cat_entry). In such
> cases, the tmp.thread.nodeName.unicode array may only be partially filled,
> leaving remaining bytes uninitialized.

I still don't understand this point. Please, see my questions in the thread for
v1 of the patch. Could you please address my questions/worries?

Thanks,
Slava.

> 
> hfsplus_cat_build_key_uni() then copies from this array based on
> nodeName.length. If the on-disk length field is corrupted or the array
> wasn't fully written by hfs_brec_read(), uninitialized stack data gets
> copied into the search key. When hfsplus_strcasecmp() subsequently reads
> these uninitialized bytes and uses them in case_fold() as an array index
> into hfsplus_case_fold_table, KMSAN detects the use of uninitialized values.
> 
> Fix this by initializing tmp to zero, ensuring that even with corrupted
> filesystem images, no uninitialized data is propagated.
> 
> Reported-by: syzbot+d80abb5b890d39261e72@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=d80abb5b890d39261e72  
> Tested-by: syzbot+d80abb5b890d39261e72@syzkaller.appspotmail.com
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Link: https://lore.kernel.org/all/20260120051114.1281285-1-kartikey406@gmail.com/T/   [v1]
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> ---
> Changes in v2:
> - Use structure initialization (= {0}) instead of memset() as suggested
>   by Viacheslav Dubeyko
> - Improved commit message to clarify how uninitialized data is used
> ---
>  fs/hfsplus/catalog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
> index 02c1eee4a4b8..56a53d2d437e 100644
> --- a/fs/hfsplus/catalog.c
> +++ b/fs/hfsplus/catalog.c
> @@ -194,7 +194,7 @@ static int hfsplus_fill_cat_thread(struct super_block *sb,
>  int hfsplus_find_cat(struct super_block *sb, u32 cnid,
>  		     struct hfs_find_data *fd)
>  {
> -	hfsplus_cat_entry tmp;
> +	hfsplus_cat_entry tmp = {0};
>  	int err;
>  	u16 type;
>  

      reply	other threads:[~2026-01-21 20:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21  6:31 Deepanshu Kartikey
2026-01-21 20:14 ` Viacheslav Dubeyko [this message]

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=5b3c275b93ba5df4bdb42dc2a5342ebe63782337.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=kartikey406@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.com \
    --cc=syzbot+d80abb5b890d39261e72@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

all inboxes | Powered by JetHome®