From nobody Tue Dec 2 01:51:39 2025 Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF9FA30CDBA for ; Thu, 20 Nov 2025 15:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.178.238 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763653487; cv=none; b=fErW61YzAf9BxE4i1lXiUjY3YuIFWiEormbOq12nVDD9LXIdZvzOQjPi64Q6TKi8y78zOVw3L+0vRoHaiJyo0jy5NHydpCFx4Aw2/Sw0F24vXGhmkFwvEzBl8PKftUClkGbSnDWKGEtgufu6BOVAjGDML3JpPDwE1V4tfvq34l8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763653487; c=relaxed/simple; bh=zDdOS9y/W8efcV/fwPdxME6P5/ym2xLzQpFVdPUlGk0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=r6lQBKyV3UxXzy3Xs/Aa8NdPb1rj1Efxrs6v2MPydwYK0sVCg3Pll76r6YSelfeZNCt4sH9yf4dFrxiQSXgQBXrXd4sa+1+2s1mrg7EykQXGS6c80b6B6WyttcgiUP+oMT5nR/V6Y8yVol82pGMjf68YxqzfaRv5s8KeaCaqRg4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com; spf=pass smtp.mailfrom=windriver.com; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b=m2KZ3553; arc=none smtp.client-ip=205.220.178.238 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="m2KZ3553" Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5AK60nlG867668; Thu, 20 Nov 2025 15:43:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=cc:content-transfer-encoding:content-type:date:from :message-id:mime-version:subject:to; s=PPS06212021; bh=HsTSciYfO KB1VLsx9zPc895qSM+/HHnQTSav0zqfnzI=; b=m2KZ3553Hyz/LqdAoQp4XUmAq SZWrfUn5ANqrAGOL8w4gZU46ANdP1LQIo6/t/vZ2XRxHWLxmrSTXMPezw94gv07w JQmBF80vtaQO7eByoppoU3afPq0iCYOu+uc6xg0lqnWHOonvDxltNhuy71fMsjbQ tmUZrPmropgVuf/wopwTgGM2iIOABGIzxYml01nhxKKssEXSR7OcRivnJ2lBRB92 54vExGcyF8bZbAhEeyk6sVf1kmlCLO31cWoPIlaHIlxaHtguYkRTdgwRWfTGm9rl XZrIx1PzAYKd5jjcsIj386yVOM402aVbHzGXJy2JI9RovwkFsUfrPDeGEZH/Q== Received: from ala-exchng02.corp.ad.wrs.com ([128.224.246.37]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4ahayrsu5f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 20 Nov 2025 15:43:27 +0000 (GMT) Received: from ALA-EXCHNG02.corp.ad.wrs.com (10.11.224.122) by ALA-EXCHNG02.corp.ad.wrs.com (10.11.224.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.61; Thu, 20 Nov 2025 07:43:26 -0800 Received: from pek-lpd-ccm6.wrs.com (10.11.232.110) by ALA-EXCHNG02.corp.ad.wrs.com (10.11.224.122) with Microsoft SMTP Server id 15.1.2507.61 via Frontend Transport; Thu, 20 Nov 2025 07:43:24 -0800 From: Yun Zhou To: CC: , , , , , , , Subject: [PATCH] jfs: fix array-index-out-of-bounds in linelock by using flexible array for lv Date: Thu, 20 Nov 2025 23:43:23 +0800 Message-ID: <20251120154323.1039302-1-yun.zhou@windriver.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: hSs8Yc79CwIj7IPTZ8SVo5j0gwya67Ig X-Authority-Analysis: v=2.4 cv=EdXFgfmC c=1 sm=1 tr=0 ts=691f371f cx=c_pps a=Lg6ja3A245NiLSnFpY5YKQ==:117 a=Lg6ja3A245NiLSnFpY5YKQ==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=hSkVLCK3AAAA:8 a=t7CeM3EgAAAA:8 a=eUl833jy40kcsfN9NwAA:9 a=cQPPKAXgyycSBL8etih5:22 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-GUID: hSs8Yc79CwIj7IPTZ8SVo5j0gwya67Ig X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTIwMDEwMyBTYWx0ZWRfX95IEndpe1Mgq pRM0+3yXRn08MRShJDNIfA2ptvPBsX25AdNgQnh8SZYVfSwYIoNhuojjH9ohDIdlntdD4qeFLIT yCzzAj5JcUw5N+2BREQPycIRqjU0Z6V0ga7lWMCse+4I+fEwFV3Phd8e3oASc1BuDlUlMAY5vFN vKihoLxul3E8OSkJ2ZbLGumC9FrrRZqFeuw2qPEzeCmzs3o6ZgP8Cu9CKlO0/nPTGll6MUFHQq1 +4t/F4lKLhvcqh8DZqVcDqtPaQBFAyAMMr2YRO6DYZCtpWeGxU1dr9iBrmqsway38ruEVEcgvnF OpxFY/fxG/Jyn5xr4aV/OswShqEZBuNWayyQ1JQ25Dofng2GHQEcsSposUx8y7+FKllfi5dv776 n+QFs5YhuwxPWuTRXU4/hpzpp3FaFQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-20_05,2025-11-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 suspectscore=0 bulkscore=0 impostorscore=0 phishscore=0 malwarescore=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511200103 Content-Type: text/plain; charset="utf-8" The fixed-size lv[20] array in struct linelock can't accommodate maxcnt=3DTLOCKLONG (28), causing out-of-bounds access. Replace with a flexible array member to dynamically fit both TLOCKSHORT (20) and TLOCKLONG (28) scenarios, resolving the UBSAN warning below. [ 101.832754][ T5960] ------------[ cut here ]------------ [ 101.832762][ T5960] UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dtree= .c:3713:8 [ 101.832792][ T5960] index -1 is out of range for type 'struct dtslot[128= ]' [ 101.832807][ T5960] CPU: 2 UID: 0 PID: 5960 Comm: 5f7f0caf9979e9d Tainte= d: G E 6.18.0-rc4-00250-g2603eb907f03 #119 PREEMPT_{RT,(fu= ll [ 101.832817][ T5960] Tainted: [E]=3DUNSIGNED_MODULE [ 101.832819][ T5960] Hardware name: QEMU Ubuntu 25.04 PC (i440FX + PIIX, = 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 101.832823][ T5960] Call Trace: [ 101.832833][ T5960] [ 101.832838][ T5960] dump_stack_lvl+0x189/0x250 [ 101.832909][ T5960] ? __pfx_dump_stack_lvl+0x10/0x10 [ 101.832925][ T5960] ? __pfx__printk+0x10/0x10 [ 101.832934][ T5960] ? rt_mutex_slowunlock+0x493/0x8a0 [ 101.832959][ T5960] ubsan_epilogue+0xa/0x40 [ 101.832966][ T5960] __ubsan_handle_out_of_bounds+0xe9/0xf0 [ 101.833007][ T5960] dtInsertEntry+0x936/0x1430 [jfs] [ 101.833094][ T5960] dtSplitPage+0x2c8b/0x3ed0 [jfs] [ 101.833177][ T5960] ? __pfx_rt_mutex_slowunlock+0x10/0x10 [ 101.833193][ T5960] dtInsert+0x109b/0x6000 [jfs] [ 101.833283][ T5960] ? rt_mutex_slowunlock+0x493/0x8a0 [ 101.833296][ T5960] ? __pfx_rt_mutex_slowunlock+0x10/0x10 [ 101.833307][ T5960] ? rt_spin_unlock+0x161/0x200 [ 101.833315][ T5960] ? __pfx_dtInsert+0x10/0x10 [jfs] [ 101.833391][ T5960] ? txLock+0xaf9/0x1cb0 [jfs] [ 101.833477][ T5960] ? dtInitRoot+0x22a/0x670 [jfs] [ 101.833556][ T5960] jfs_mkdir+0x6ec/0xa70 [jfs] [ 101.833636][ T5960] ? __pfx_jfs_mkdir+0x10/0x10 [jfs] [ 101.833721][ T5960] ? generic_permission+0x2e5/0x690 [ 101.833760][ T5960] ? bpf_lsm_inode_mkdir+0x9/0x20 [ 101.833776][ T5960] vfs_mkdir+0x306/0x510 [ 101.833786][ T5960] do_mkdirat+0x247/0x590 [ 101.833795][ T5960] ? __pfx_do_mkdirat+0x10/0x10 [ 101.833804][ T5960] ? getname_flags+0x1e5/0x540 [ 101.833815][ T5960] __x64_sys_mkdir+0x6c/0x80 [ 101.833823][ T5960] do_syscall_64+0xfa/0xfa0 [ 101.833832][ T5960] ? lockdep_hardirqs_on+0x9c/0x150 [ 101.833840][ T5960] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 101.833847][ T5960] ? exc_page_fault+0xab/0x100 [ 101.833856][ T5960] entry_SYSCALL_64_after_hwframe+0x77/0x7f Reported-by: syzbot+5f7f0caf9979e9d09ff8@syzkaller.appspotmail.com Signed-off-by: Yun Zhou --- fs/jfs/jfs_txnmgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jfs/jfs_txnmgr.h b/fs/jfs/jfs_txnmgr.h index ba71eb5ced56..391c0d28e1bc 100644 --- a/fs/jfs/jfs_txnmgr.h +++ b/fs/jfs/jfs_txnmgr.h @@ -165,7 +165,7 @@ struct linelock { u8 l2linesize; /* 1: log2 of linesize */ /* (8) */ =20 - struct lv lv[20]; /* 40: */ + struct lv lv[]; /* 40: */ }; /* (48) */ =20 #define dt_lock linelock --=20 2.34.1