Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1142067lqd; Thu, 25 Apr 2024 07:11:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQsnMQIxsvZeeavs+HaGB/Zr5pA0buwUzw2tmmouCRB8L/QR440PigwwcfTxmLFT7ftON9ghm3as25ipNS58WYHPDI3qdDfd2Gi2CU6g== X-Google-Smtp-Source: AGHT+IGWe96y3n1q4AGHwXFhHSxPHHfiJh+XkySd7OWojdbm4I0qQS26yTSmhCw76CR88zaJPlhh X-Received: by 2002:a17:906:71a:b0:a55:a072:1ab8 with SMTP id y26-20020a170906071a00b00a55a0721ab8mr3833076ejb.27.1714054294205; Thu, 25 Apr 2024 07:11:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714054294; cv=pass; d=google.com; s=arc-20160816; b=zsZqfNphmoKC/RzWwLkXfNc1cMof/0BxnW1grbOg0j6w1lTeoEPKiIqOKu3kKGyxHa PI/CwHJjFvNhuUCyXiBRruYpOdkMUIS8OBk/zGfHPsL2XP4wWZwUxMfs99f0vz5Smryl Tvf53TvaULQUlPvF1vhTxUZXlFTtvCFrRm/HFAUV42A2PGqrCOeRmG0NVhKVmZnAUP6r fj/sM4dDPkbwPfeDlmqFAK2MFkyFAqz1ErkaFaiQQT/e+15eBm0fyORhYbE0dJvwgY71 Uu5qvhEp/MLKJ2oYxJIQusQ98/dDqC5khVDj5ch4aZ9uT0wk6/Qd10hWIIJ/twh5ylkl lipw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=omf2YA5ZrMAZoe/viDc+5pR/0l+e+gj7ozLHZXJSd+A=; fh=XkMi/yA/Th6Xp/oqrPvxfMhWt9x5exIAqs58iiIP0EA=; b=jr1LBcL9Yrwvb7xP3hOnzlPJviGFvsCbXQHtuFG0YUpXP2uXDkMLbSqtimefBQA6cP QumFvmxjchyT3TwWhfRuu0qBx9qT0JgabX9naEaWGCzxTlpraVmwh+aoWgQk/4ms9o+f g3wV/2O92cOHVXt+agtostQBJT57CcasLd8G9ItY3cMvvOJbbK1AZ3zykbD2UW2o8/pW WAJRe1jN48E1uwyfxNNtMg1tsUQ4QgyEpdlve0fHsCvAd0zyyMAHPcpjLeE+WNaHn/Eh 6OU8R0TbEZhbD55dRK3AdB5aNhiOmg9mnDcSOMwN39rXIZGbLbqPCU/3dReq/LvhZmmd Eo7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L5qEmBqq; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-158665-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f22-20020a170906c09600b00a470e672ff4si7353606ejz.585.2024.04.25.07.11.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 07:11:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158665-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L5qEmBqq; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-158665-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id EAF911F276C0 for ; Thu, 25 Apr 2024 14:11:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11FFB14A089; Thu, 25 Apr 2024 14:10:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L5qEmBqq" Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 EDFA6171C2; Thu, 25 Apr 2024 14:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714054246; cv=none; b=HCBDa/mPiuB9ZJjQu8UUGvfkVKpAWL6zKYlkKenok2JvEvaZ2lMhfbL7tkDRwy2ofRtZXguSHb3pQ7p6cHBVT87Iyr2V3grA9QRnTL5VmxtfbFHEkjTofZNvSEpH2ruZ2l1gMeq2T/MviPLZSVAcxS2e5fII7EYGwnF881UuJWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714054246; c=relaxed/simple; bh=I9RuxejvwT5lszFHr8dtEp25xDltyZrOPajVFNie+N0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TqQ2GPaYImcwO1/TwEIuH2I/CsJ4qGsD7+OqeCgzFxJS2GPljXgwzblLG0mf0IfZYNr68oSVhvvUDKDonsy4jVBNpTh7pEosERL3emnwrysCgJvUV3qKTQ2Jarkqlak0Eec4ej1nONoY4KlNPIxV2KiO7dOrJPWgMDGAywRdlu4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L5qEmBqq; arc=none smtp.client-ip=209.85.166.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-7d5db134badso37872639f.2; Thu, 25 Apr 2024 07:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714054244; x=1714659044; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=omf2YA5ZrMAZoe/viDc+5pR/0l+e+gj7ozLHZXJSd+A=; b=L5qEmBqqSLa68A90cAWh+mjckXz6MlRWkQKeNWiF9Kw0m1Vr02kHSRE12aAbZAQDXu C1+5WG8mVA8RdSwKQABxTB4P8wwX+VRprLw2aOlUwm67v/7br8U7kx5jMjV9YjJhgFPi qZnTkXpIZmKz8MWVD1c/N4yZllOAOuYYb2GRfXqXDTE63f+hGzB6RSGkXyBiAN0K4+t/ qDUCa/NxuijKifqgT3zPrsZfSy3JZjSybIRmelzua0lgS5XzcsHHBROBReKJ3fC7kB58 iKEkNgbOZe+xgGszZu71FF4Gl2xjSmv+4bZmdRrUGLQWDxPTJw3AfElGq8DXuSPnj7Nx kFww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714054244; x=1714659044; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=omf2YA5ZrMAZoe/viDc+5pR/0l+e+gj7ozLHZXJSd+A=; b=xFTDec9LDCxDW+uInfssNx3Dlshho6ezTBxQBpHUuNJXdbrfkQF0oeL+1SpUjo/zJM aqzbclIm0DprPo4SFfTQ5TB1STdJZnQRr+n4nBDnQCq5qi3vsWuQ3ak/tDL5YtQmjKkl gl2qW3RluIKSsMNwIIQNzDd/XGu1++Z2zSTNVKadOPVRb/PyCeOwPxik9rx9h3sRE2wA NyVHtvhf14/g6VmNwBXF0/GcnFtq6/dlswiz57iyA0XkB7wsyy8CeF8MwezZ332r8NM8 4nG8oVLIQJgNFzoj7wfi6/Lc4oh7bJhpvV1ZBzhnqF9bZ6/PlP9VoGVi8tFFy+Z6zp1x qxhw== X-Forwarded-Encrypted: i=1; AJvYcCXD6SamtUsFIIpDFtKqiNQZhJuU4AxeLwwLjWWRvOd9DwiRwi+S7nxPFp9+MHASyw5Y557ECrlMj0tKZ3aIxkD3VU0G1bnwgRPIof02naazfiynO08MtMLHfxwmmQykf46Q8EXMv6FznawG7A== X-Gm-Message-State: AOJu0Ywyju/NkCvV+KqdBM+x92GKLgSdw0F94kaa/BlQ69Je7z+iCl4v +kKuK91oMm6nFiRxlbOje2Dh8yd7OhRdPTVuJp4Xt6mhiHy5Nmub X-Received: by 2002:a05:6e02:1e0a:b0:36c:c6c:dc27 with SMTP id g10-20020a056e021e0a00b0036c0c6cdc27mr6923795ila.10.1714054243955; Thu, 25 Apr 2024 07:10:43 -0700 (PDT) Received: from kernelexploit-virtual-machine.localdomain ([121.185.186.233]) by smtp.gmail.com with ESMTPSA id y5-20020a637d05000000b005f3d2a9a91bsm11616066pgc.89.2024.04.25.07.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 07:10:43 -0700 (PDT) From: Jeongjun Park To: willy@infradead.org Cc: brauner@kernel.org, jfs-discussion@lists.sourceforge.net, jlayton@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, shaggy@kernel.org, syzbot+241c815bda521982cb49@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] jfs: Fix array-index-out-of-bounds in diFree Date: Thu, 25 Apr 2024 23:10:38 +0900 Message-Id: <20240425141038.47054-1-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Matthew Wilcox wrote: > If that's the problem then the correct place to detect & reject this is > during mount, not at inode free time. I fixed the patch as you said. If you patch in this way, the file system will not be affected by the vulnerability at all due to the code structure. Thanks. --- fs/jfs/jfs_imap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 2ec35889ad24..ba0aa2f145cc 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c @@ -290,7 +290,7 @@ int diSync(struct inode *ipimap) int diRead(struct inode *ip) { struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); - int iagno, ino, extno, rc; + int iagno, ino, extno, rc, agno; struct inode *ipimap; struct dinode *dp; struct iag *iagp; @@ -339,6 +339,9 @@ int diRead(struct inode *ip) /* get the ag for the iag */ agstart = le64_to_cpu(iagp->agstart); + agno = BLKTOAG(agstart, JFS_SBI(ip->i_sb)); + if(agno >= MAXAG || agno < 0) + return -EIO; release_metapage(mp); -- 2.34.1