From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796367460; b=wYq7E5fN8spWObwt+l4UiPbGcvHf59BNBB/Nlk2KsPPLybLGBWk+la5aPV/lS+37K4gf 7p+pAOXs3m/53olWtaUh9ntipIqns7RwNlaAZmY2MHM7v6rflgOdkdb+yxMftboMMcrjt +yNuGzOY9ew6OSIg6JxPviqzpihIxurUKShQJZjPypdg0CNf0jN0ad+rYXHzn8nHSVPyB fjy2d5hXOUDHAcKGFQ8F/Fn+T53SkFFNk7OPbmw8YSkeL4APAr/aTmiC053EQwe9jAGSP /rwJJSsRXENuMu1HqOvm/ULSwTQjVSfkm/RUENnyXJGiPwQVya14KLX4yDc8GD6cj2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796367460; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jRONnLoEvE6xJoW/pKqYD+KPgtA7V/RNHqT/7xDzQ6M=; b=AqDpnTqL0sQt1gh0X8dWOkCj7pS+cu90xhLOSfNSZDolA8yneCywoALmKoIg1Yaufy7W 6Dfy6kKH9YlCm9g0r6A9BesrTm2UXYc2Di+f9hgK9BRj3PFHsHRVd09zK0ac0rtMpZwZu FBJNu6LeyGbDFcHPXLHXgtxOEPacF5pyI1WfTS3UDNxjFzBYJreU9B5AKZMV4IDWrMVEa WoI8uksxgyWtjW2vINWbhXYDOzbMGRE5ueCbs5cbEo0EGS0EF7XAo8MvXcsS2UJLc2OWs BjXmZ4UYWeKJ5Z4B3CehJeVXeooGsEbY88+4cXBkW+l2qtwMjPMT8tRMGSXbasFNwag== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SZl1QWNZ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96E63606A322 for ; Fri, 4 Dec 2026 06:57:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SZl1QWNZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09E4A1F000C2; Fri, 4 Dec 2026 06:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796367460; bh=jRONnLoEvE6xJoW/pKqYD+KPgtA7V/RNHqT/7xDzQ6M=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=SZl1QWNZ3m+HOrmfD7O5e43El4GBNnE/HY/d7adU1LtwZuJM+QLyvNVY//NxEKMYE 1Up5R63QmB0zgdGaOtdhyPaAVOwR0dtXqvmrorZkVkluRj7mL3f2mX7C9TBrHwU4xB aMG/1XyGtWtqN4H48A9R/RkRFHsop0309UNMELK3U5RAoA/TtTtIr9+N36dFmnbrPp LHAlvTt7cTeZEKF8b5Ycbj7GRZT4tG0stFrA7qCibLcfoZNMLEcrNn6nSvyCYT2zix giw4yRxbd4hRt7Dg+DEoGhCl1GjNLieHWiK4/fcbv30aUsUc8FbrLodURscIGUrOPr KG/sJifQJN0sw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3] gfs2: validate log descriptor tag counts during replay Reply-To: sashiko-reviews@lists.linux.dev To: "Kyuwon Cho" , "Andreas Gruenbacher" Cc: "David Teigland" , "Steven Whitehouse" , gfs2@lists.linux.dev In-Reply-To: <179636379461.1106205.14894674361180500595@skku.edu> References: <179636379461.1106205.14894674361180500595@skku.edu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 06:57:39 +0000 X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] gfs2: integer overflow in gfs2_struct2blk() bypasses revoke validation -- commit 06a5c8674445cd678fa93b7e482b13dc58aa34fa Author: Kyuwon Cho gfs2: validate log descriptor tag counts during replay This commit validates metadata, journaled-data, and revoke log descriptor counts and lengths during journal replay before the pass check. > diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c > index 657edd406dd1c..e08d221f038c0 100644 > --- a/fs/gfs2/lops.c > +++ b/fs/gfs2/lops.c [ ... ] > @@ -925,7 +930,11 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc= *jd, u32 start, > int first =3D 1; > int error; > =20 > - if (pass !=3D 0 || be32_to_cpu(ld->ld_type) !=3D GFS2_LOG_DESC_REVOKE) > + if (be32_to_cpu(ld->ld_type) !=3D GFS2_LOG_DESC_REVOKE) > + return 0; > + if (!revokes || blks !=3D gfs2_struct2blk(sdp, revokes)) > + return -EIO; [Severity: Medium] Can gfs2_struct2blk() overflow when given an untrusted on-disk revokes coun= t? fs/gfs2/log.c:gfs2_struct2blk() { ... if (nstruct > first) { /* Subsequent struct gfs2_meta_header blocks */ second =3D sdp->sd_inptrs; blks +=3D DIV_ROUND_UP(nstruct - first, second); } ... } Since sd_inptrs - sd_ldptrs is always 6, DIV_ROUND_UP(nstruct - first, second) evaluates (nstruct + 5) / second in 32-bit unsigned int arithmetic. For ld_data1 in [0xfffffffb, 0xffffffff], the numerator wraps to 0..4 and divides to 0, so gfs2_struct2blk() returns 1. A corrupt revoke descriptor with ld_length =3D=3D 1 and ld_data1 in that range then bypasses the validation check. Replay scans all sd_ldptrs slots in the block into jd->jd_revoke_list because !--revokes never reaches zero, which can suppress valid block replays in pass 1. Using 1 + (nstruct - first - 1) / second inside the nstruct > first branch (or 64-bit arithmetic) avoids the 32-bit overflow. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/179636379461.110620= 5.14894674361180500595@skku.edu?part=3D1