From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBFB03B777B for ; Fri, 17 Apr 2026 10:12:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420765; cv=none; b=eZPk9+H/znBgaZEX+oeLfAR/zp8ZmowlmU2LRPZmdUXdVWCF/LMb09BvGIMUVrECsDUZDCV/m0q0xj1fqTj/okmsxy4U2YCm2eVP3cJf8SlPcedK3W54ks8RkphsUlx8lHUJ2pzGn9XV2LoeTaR2miJh23GYpEzhXrXIPgUeChQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420765; c=relaxed/simple; bh=R/04tfqeBqUdLwxw99y65prrFCE2AEn9HDHlXlUTLwU=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To:Cc: Content-Type; b=bTdD6f+y0PJJYsHgiubAQCGocymaQAeRoO0HPx3JcjMJCj1sffHQy3V6zAZjhFI44iRS3vP7AknkXVFawUwqGUscFYypPvXbulkl5zUO9NoBuC6Gqixxd1Rv9BumFI0m12SJXQohr5qv4rpivpC4BjPNqjAKwFiCE+4t5k1yXjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-68e924f632bso954730eaf.0 for ; Fri, 17 Apr 2026 03:12:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776420763; x=1777025563; h=cc:to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8FSp/5PzhLyd/Egyl6IT+FZNol6uZAaV3T6yuTPvJqY=; b=K2x0tHcbo0X9sQ1z29HUHOlqaP/SsjBSLurf74CllBgqYN5wrxMOjr35ZWjasgeW25 qdKgKh/xImoSgyliCWsjzdiHkZ3gEf3mSMnm9whNfYe7ffLepPlHORLtiM9/LOAHfv/t KnttHyLMbTgGcqsw2egZ9VsvizsAy/PR3Ks0MSngAzH4gmabwVNgU18Ikv1Ps4XHJ003 aHp/5NoFHeke5aEcuy6YC6uxeAiMwNSy/GYtTktBJ6lrKBGa5jgxi6kgok8rzU5yTAJT 3+ErfrZyrQLdY7kWyh0mp5Jxo8c+6PePzCatso9ltzoQt8qBXIjEMjqyDg2C/c7h77gC 3MXQ== X-Forwarded-Encrypted: i=1; AFNElJ+9RR+ZpbgZuJUReGJrWH2K4K6WFRqBrWzuiQb3aRTucXJ66WyawXuvCipPGOCmmd4+PLp5N2o1uI5addA=@vger.kernel.org X-Gm-Message-State: AOJu0YyQ/wJgseJtm2J6Y29Leynji+IO573tO4wCTfBoiQODO5Fcb9+R Ip8dCi41urrpQXRjOxwGI2vbObKK/5ABV+mtBHhxe1ohSMAE4g1J0UqdEly4zfIVFBWIMiJzRo9 WbhaUNHOnMGY4eUraCtI70NFg2BVlNZN9afFhwwRf7IM6PYCWDx8BKN4l/7A= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:607:b0:68a:1c7c:cda9 with SMTP id 006d021491bc7-69462ef0edamr1178239eaf.32.1776420762914; Fri, 17 Apr 2026 03:12:42 -0700 (PDT) Date: Fri, 17 Apr 2026 03:12:42 -0700 In-Reply-To: <20260417101240.2491632-1-tristmd@gmail.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69e2079a.a00a0220.1cdc.000e.GAE@google.com> Subject: Re: [PATCH] ntfs3: zero-initialize trailing VBN slot in index entry From: syzbot To: tristmd@gmail.com Cc: tristmd@gmail.com, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" > From: Tristan Madani > > #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master This crash does not have a reproducer. I cannot test it. > > allocations > > indx_insert_into_buffer() and indx_delete_entry() each allocate an > index entry buffer with room for a trailing VBN (virtual block number) > sub-node pointer: > > up_e = kmalloc(sp_size + sizeof(u64), GFP_NOFS); > memcpy(up_e, sp, sp_size); > > re = kmalloc(le16_to_cpu(te->size) + sizeof(u64), GFP_NOFS); > memcpy(re, te, le16_to_cpu(te->size)); > > The extra sizeof(u64) bytes reserved for the VBN are left > uninitialized. When the entry is a leaf node (no sub-nodes), the VBN > slot is never written, and the uninitialized bytes are eventually > written to the index buffer on disk. When the index is later read > back, ntfs_read_hdr() processes these uninitialized bytes, which KMSAN > flags as a use of uninitialized memory. > > Fix this by using kzalloc() instead of kmalloc(), ensuring the VBN > slot defaults to zero when not explicitly set. > > Reported-by: syzbot+2472d48b2d3b2a23a570@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=2472d48b2d3b2a23a570 > Fixes: 522e010b5837 ("fs/ntfs3: Add file operations and implementation") > Cc: stable@vger.kernel.org > Signed-off-by: Tristan Madani > --- > fs/ntfs3/index.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c > index XXXXXXX..XXXXXXX 100644 > --- a/fs/ntfs3/index.c > +++ b/fs/ntfs3/index.c > @@ -1838,7 +1838,7 @@ static int indx_insert_into_buffer(struct ntfs_index *indx, > > sp_size = le16_to_cpu(sp->size); > - up_e = kmalloc(sp_size + sizeof(u64), GFP_NOFS); > + up_e = kzalloc(sp_size + sizeof(u64), GFP_NOFS); > if (!up_e) > return -ENOMEM; > memcpy(up_e, sp, sp_size); > @@ -2228,7 +2228,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni, > } > > /* Copy the candidate entry into the replacement entry buffer. */ > - re = kmalloc(le16_to_cpu(te->size) + sizeof(u64), GFP_NOFS); > + re = kzalloc(le16_to_cpu(te->size) + sizeof(u64), GFP_NOFS); > if (!re) { > err = -ENOMEM; > goto out; > -- > 2.43.0