From nobody Fri Nov 18 02:06:54 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ND0Xj22k6z4d933 for ; Fri, 18 Nov 2022 02:07:17 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic317-21.consmr.mail.gq1.yahoo.com (sonic317-21.consmr.mail.gq1.yahoo.com [98.137.66.147]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ND0Xg3fbHz3wPr for ; Fri, 18 Nov 2022 02:07:15 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=OUQIdwsg; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.66.147 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668737233; bh=z7cH2Io05CsOSfmzDzFJpNBo7tpgkS4YPnQZkDxvR5Y=; h=From:Subject:Date:To:References:From:Subject:Reply-To; b=OUQIdwsg3eEtKN4K7fsJW28E9HKLSyaTqLdZDfax1o9B3ZZdpPJJgSH2ZBr/j/Vydj12AqZ7s42gSVFDjfqsNt+X/UhQ9OqD0dIs7YezykXSqKY6vTYlTQSyY2OKHogJG0Hk2PIE6eSbSvMOICXBKCmhAbWWwgPO4qYcThc4+EdB3uSMGbLakTB073LAfNbajdE+Zrqm7QbiDsJiP6dO/qZOgnRSl+XnWnAoY4ZoRU5Qgj57ZwWxzsm1vu37itaRL6En6qLe3HKmbwNcS4+jXz8P21iMUcfvJBh+b6eiuc+XE6CDQec7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ZTMoIdjCuOwDoR7eIdf1wp1MqashiUCk3MMrbGOgPQmC_RiOqrMn0fncUtuCWfu5.iK0 tXaxJd8uyAcOTpPjvsJPKXTjW0Bwa25RSpd64zwdZNrTlU5Fhk20T.tCvtV2XG4eWQOlsjGwKhrD daE4JTo.9I3o8jnBBtmkWliLEufryh16mtc4Ts3RWvdHamq_4Ry0RSBAimiwPcRYTh.Oe0Lr7zmX 0dAoR7ffrlEC.bSsdYv4tno__Iz97LvMZBIMPxaHf38cAZzEDIRKydhv3WgVt.C1fVAYcBSi7h_2 lxFgLGQxnK2uzkf1F9KAmDgrweZg.JlG8CRs4FNaIvrzBGm67yJ6NlUvNZIrJJHuzWhMt6xzFMVV RkBUF9VFB1K0HZChmZi4nHbwZ2CvqTObLR4yCSBt90XNepVaJ17abLL_QvDw1pjM9lFM6qGchcgJ MesM.gL3dirGXOmYd.u9ogaAWBQPGM7YFDkiSk51o50DTc1nBus1d3fHiZnwSdoGi.EP74V6H.Xo ZQltMo_9F5XuAX2qxRT2VeD155I8KlTcrfDgfy4TfBBKU5TY1fjmAB_MBIyKVCL6BZfK8rN7SrHv 3GYvg8TxanvL84Y_MrybTHieWCsGIoiiM8xloUh.v_HjtYL2oR9byRyi7a52GpYn1ESjkdoUxSdc b55eYu01G4K.iZ22HIH8Dbsg_nGAwEtF48Guh6dMh8HOwbOFJTbUpDfXIINJfpskiN1rUaOTmOdz Q X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Fri, 18 Nov 2022 02:07:13 +0000 Received: by hermes--production-bf1-5878955b5f-dvp8b (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 3a47349f9acb1fc18163348dc2021bda; Fri, 18 Nov 2022 02:07:07 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Subject: git: 8435a9b20684 - main - Updates to UFS/FFS superblock integrity checks when reading a superblock. Message-Id: <39DF35FC-6F41-4365-AF10-F88C0A920F06@yahoo.com> Date: Thu, 17 Nov 2022 18:06:54 -0800 To: "mckusick@freebsd.org" , dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3731.200.110.1.12) References: <39DF35FC-6F41-4365-AF10-F88C0A920F06.ref@yahoo.com> X-Spamd-Result: default: False [-3.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; RCVD_IN_DNSWL_NONE(0.00)[98.137.66.147:from]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; MIME_TRACE(0.00)[0:+]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.66.147:from] X-Rspamd-Queue-Id: 4ND0Xg3fbHz3wPr X-Spamd-Bar: --- X-ThisMailContainsUnwantedMimeParts: N Kirk McKusick wrote on Date: Thu, 17 Nov 2022 22:51:52 UTC : > The branch main has been updated by mckusick: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D8435a9b20684ba8bcda3df31d06b4d5e= ac9431a7 >=20 > commit 8435a9b20684ba8bcda3df31d06b4d5eac9431a7 > Author: Kirk McKusick > AuthorDate: 2022-11-17 22:50:27 +0000 > Commit: Kirk McKusick > CommitDate: 2022-11-17 22:51:15 +0000 >=20 > Updates to UFS/FFS superblock integrity checks when reading a = superblock. >=20 > Further updates adding casts to avoid 32-bit multiplication overflow > inspired by fixes in commit 017367c1146a69. >=20 > No legitimate superblocks should fail as a result of these changes. >=20 > Sponsored by: The FreeBSD Foundation > --- > sys/ufs/ffs/ffs_subr.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c > index b6b0be56fc73..67f4fcd92fd8 100644 > --- a/sys/ufs/ffs/ffs_subr.c > +++ b/sys/ufs/ffs/ffs_subr.c > @@ -473,13 +473,15 @@ validate_sblock(struct fs *fs, int flags) > FCHK(fs->fs_fpg, <, 3 * fs->fs_frag, %jd); > FCHK(fs->fs_ncg, <, 1, %jd); > FCHK(fs->fs_ipg, <, fs->fs_inopb, %jd); > - FCHK(fs->fs_ipg * fs->fs_ncg, >, (((int64_t)(1)) << 32) - INOPB(fs), > - %jd); > + FCHK((u_int64_t)fs->fs_ipg * fs->fs_ncg, >, > + (((int64_t)(1)) << 32) - INOPB(fs), %jd); > FCHK(fs->fs_cstotal.cs_nifree, <, 0, %jd); > - FCHK(fs->fs_cstotal.cs_nifree, >, fs->fs_ipg * fs->fs_ncg, %jd); > + FCHK(fs->fs_cstotal.cs_nifree, >, (u_int64_t)fs->fs_ipg * = fs->fs_ncg, > + %jd); > FCHK(fs->fs_cstotal.cs_ndir, <, 0, %jd); > FCHK(fs->fs_cstotal.cs_ndir, >, > - (fs->fs_ipg * fs->fs_ncg) - fs->fs_cstotal.cs_nifree, %jd); > + ((u_int64_t)fs->fs_ipg * fs->fs_ncg) - fs->fs_cstotal.cs_nifree, > + %jd); > FCHK(fs->fs_sbsize, >, SBLOCKSIZE, %jd); > FCHK(fs->fs_sbsize, <, (signed)sizeof(struct fs), %jd); > FCHK(fs->fs_maxbsize, <, fs->fs_bsize, %jd); >=20 Just a note about C99+ vs. some details above. Context: dioxXu conversion specifiers related material. %j is from C99 for intmax_t and uintmax_t "expected argument type" %ll is from C99 for long long and unsigned long long "expected argument type" =46rom what I can tell, FreeBSD tends to avoid the "Format macro constants" (not listed here) for trying to have system independent notation and tends to use intmax_t/uintmax_t with %j . This might (eventually) survive better than use of %j with int64_t and u_int64_t . Technically intmax_t/uintmax_t could each be 128 bits or some such, even now. I'll also note that u_int64_t is not from C99. uint64_t is from C99. I've no clue if that is important for this code. int64_t is from C99. =3D=3D=3D Mark Millard marklmi at yahoo.com