From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) (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 A792E3B3893 for ; Fri, 17 Apr 2026 10:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420724; cv=none; b=ftJsBx9Ui7YZaYB8t1lEFBhmB96Ijca96o08+lgFtQ8iQFLfbZWFerTQhu7Olfk5HcqAHXYNvJ9R6WnsFyqefVjNsAOutdF+JwQ/f5Q0oZSbjrOu7pHaOCdKnsL9ntcb58mIwmCRSWRn9Iv11V/HMRN7ivq/0k4klDhERgv+spo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420724; c=relaxed/simple; bh=HLUqdok3PQGuub4CaicJ1Pcbw7SPadfuhPIcp9s0Z28=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=T5f7MMF9bpibH4ckTh6J5TruMVUXWStSrvWvLHOd3LiDhYblhPCBEwUaWnFU4w/h+7Aemh70EAcSdw+3BuVLoD82B3vumqqNhP+bp5casD3T3pS5EkRtyTQp6xU/nPPO9dn10YSUJGeEFU5T1K9+fnXvYq1LEF7IzTZk36VhzAA= 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.210.69 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-ot1-f69.google.com with SMTP id 46e09a7af769-7d9e1866bf1so510298a34.1 for ; Fri, 17 Apr 2026 03:12:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776420722; x=1777025522; h=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=JXEgEfVyPu4UFVBKv1QBhs+d9MYXHkUv+Oc6eFdfYzE=; b=hCDev7GDRD8s09SN1txtLL/G2m44hifXyc0SnWIYgfh7oAL0spaKZZf4n7dMUfafTT FrYWeHEmi3Pncece781FzjWex63RdQfv4nBppEdq42DDWYSi949tmhY2B9ROZ1/02AGj tAiTGeVptUicDTTZa6ASqGjz9y6liqTUq+UNMWInMg4tYNhxXmWvAmt6vMTVKkODBL2W VvFCnOs4rKqnoYQtaA+e9wlDznTMUu01ccIGBJSdLA3oC+VNGQqGxVZxCeaz3UZ4hFv8 NsnsxmLKRP/TAAC1XuNWYF3mO3vJN0uN1LLOlKl2Rg+1iFZgdgoog/5s4Wr08+pWq0gy JtZw== X-Gm-Message-State: AOJu0YxI0imUkRvznQUnYXDIT/SVpS2oHf4fDew4snLQbo2y/xHANynp FtpihrQvmRewfbCKffdNYgBUZlHBRrys8nwa8arMdwgBg039U7NFVxYQRZsKJpIWjjXLv+3ZFeO aT3mxptBgb4WtvWZo/0iu/kT6hghYEwlfiRwNsAT7W4UcO6H5CaLH96fPdPM= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:e906:0:b0:688:93a0:85f0 with SMTP id 006d021491bc7-69462ee8928mr1108442eaf.36.1776420722680; Fri, 17 Apr 2026 03:12:02 -0700 (PDT) Date: Fri, 17 Apr 2026 03:12:02 -0700 In-Reply-To: <68197d2b.050a0220.23d401.2859.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69e20772.a00a0220.1cdc.0008.GAE@google.com> Subject: Forwarded: [PATCH] jfs: zero-initialize btstack to fix KMSAN uninit-value in BT_STACK_DUMP From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] jfs: zero-initialize btstack to fix KMSAN uninit-value in BT_STACK_DUMP Author: tristmd@gmail.com From: Tristan Madani #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master BT_STACK_DUMP() unconditionally prints all MAXTREEHEIGHT entries of the btstack->stack[] array. However, only entries between stack[0] and *top have been written by BT_PUSH(); the rest contain uninitialized stack data. When dtSearch() or dtReadFirst() detect a corrupted B-tree that exceeds MAXTREEHEIGHT, they call BT_STACK_DUMP() for diagnostic output. Reading the uninitialized entries triggers a KMSAN uninit-value report. Fix this by only iterating over the entries that were actually pushed onto the stack (from stack[0] up to but not including top), rather than blindly dumping all MAXTREEHEIGHT slots. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: syzbot+ba5f49027aace342d24d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=ba5f49027aace342d24d Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani --- fs/jfs/jfs_btree.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/jfs/jfs_btree.h b/fs/jfs/jfs_btree.h index a1312322..b6737db2 100644 --- a/fs/jfs/jfs_btree.h +++ b/fs/jfs/jfs_btree.h @@ -130,10 +130,12 @@ struct btstack { static inline void BT_STACK_DUMP(struct btstack *btstack) { int i; + int depth = btstack->top - btstack->stack; + printk("btstack dump:\n"); - for (i = 0; i < MAXTREEHEIGHT; i++) + for (i = 0; i < depth; i++) printk(KERN_ERR "bn = %Lx, index = %d\n", (long long)btstack->stack[i].bn, btstack->stack[i].index); } -- 2.39.2