From nobody Mon Aug 29 06:15:23 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 4MGKtN0YD0z4bNlh; Mon, 29 Aug 2022 06:15:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MGKtN04y0z3WRD; Mon, 29 Aug 2022 06:15:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661753724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AhJgKyulp78etDLqXaPEpdacHHL2jHSI5Gtsv9ot1qw=; b=x60g3dPKtziBr4Y+TM80Sk9I6pCcX5oBUFc/O7crdEXpJo0/Ycj2xrVDs9HgVsiREm3hij 6d4124DlE/jmSCujVrNrERQpYEVV76S3g1DHb8xNyiRbL9s7kdhAXx87xuNqpQ6/A9eFCg vl1h3MtOCdi8nKpi9Yaq7fYNjlFdwdtQxeeRQcVl4tualk7gfpTkULiftkXXeZgBvIY/io ZxH/duK6SqJCAIw6JglXFhuQ8oHnPxDkHtrbrNbnsy38gKUPQspGEaA+tUa8sBtfYDH4Fz ln0l4+fegwbZoD27S5aYPqGxrRaJTJsdz8YHmF5SOQuHhp0BUxSCmO4qgWpGIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MGKtM66VWzLDm; Mon, 29 Aug 2022 06:15:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27T6FN5U004413; Mon, 29 Aug 2022 06:15:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27T6FNqx004412; Mon, 29 Aug 2022 06:15:23 GMT (envelope-from git) Date: Mon, 29 Aug 2022 06:15:23 GMT Message-Id: <202208290615.27T6FNqx004412@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 9dee5da7450e - main - Updates to UFS/FFS superblock integrity checks when reading a superblock. 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9dee5da7450e8530c9fec51c9a16ecd42da78e55 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661753724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AhJgKyulp78etDLqXaPEpdacHHL2jHSI5Gtsv9ot1qw=; b=YZACg2032OFu0k4HmYn4CZ+uegdq3XKJN4SGoZqdvA4c11NC1OVQwQZyn5FaMgMJIJtkp8 eQF+cgKFF/epyJxK8bJjUWBbAOei51bl2ZssOoKX8QYiEs8n9tZJs2/AsLKivaO7XyLr2J tsiFzbztNSQFIkvVJ1fvE7CBf7iHK7cHsc8lz/1ZObOSHQNz6n7bFQJyUJiJC6thdWiZfn M1eaQfWrImvfb9PkZjO5/gVXHg0A/h7P3nLCYblTsQ0xwOHAlndqTL0KRODFsKQHPxvrNT x6TmJjqwh8+HO4PcUGm72m7jOg2M1rYdkdU0N+3mqoDHQhlhilGVMsa4G2Oxvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661753724; a=rsa-sha256; cv=none; b=wol4xeNDRCDf62zykshcMEe2qA345l/ilcUoAPnIN1QvA00k/YbGW2xTZAw26wWDlpSASn daZBpk1NkXJNy5P0oykfYbLzgFsuSlXuoFb2TJN8siD/jOg+7ncNvuyuPsg5LDhqq5Cnia iTDGpk+4p6fmNTnSqq1ASi/c6Dazp0r99sT/d68ZSdATnJ0UDjb+4AJl3XJPny7edf7bIi h3Hg/hwjLdjDkzkOzjBt1Ec0hV3xBnFhm0AnGc2IRVcWotY04fPxuahs34rCVfRMqTi6gk 29RGvrf92ppz4aJJQPRcTbhwTosYAS8PVJ7jTBXcKe+dAcmDqfSaNw7Or7DmJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=9dee5da7450e8530c9fec51c9a16ecd42da78e55 commit 9dee5da7450e8530c9fec51c9a16ecd42da78e55 Author: Kirk McKusick AuthorDate: 2022-08-29 06:14:35 +0000 Commit: Kirk McKusick CommitDate: 2022-08-29 06:14:35 +0000 Updates to UFS/FFS superblock integrity checks when reading a superblock. Further updates based on ways Peter Holm found to corrupt UFS superblocks in ways that could cause kernel hangs or crashes. No legitimate superblocks should fail as a result of these changes. Reported by: Peter Holm Tested by: Peter Holm Sponsored by: The FreeBSD Foundation --- sys/ufs/ffs/ffs_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index f6c27cb38d62..b71ebf2a0617 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -473,7 +473,6 @@ 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_inopb, !=, 0, %jd); FCHK(fs->fs_ipg * fs->fs_ncg, >, (((int64_t)(1)) << 32) - INOPB(fs), %jd); FCHK(fs->fs_cstotal.cs_nifree, <, 0, %jd); @@ -505,6 +504,7 @@ validate_sblock(struct fs *fs, int flags) */ if (error) return (error); + FCHK(fs->fs_ipg % fs->fs_inopb, !=, 0, %jd); FCHK(fs->fs_sblkno, !=, roundup( howmany(fs->fs_sblockloc + SBLOCKSIZE, fs->fs_fsize), fs->fs_frag), %jd);