From nobody Fri Dec 06 02:12:17 2024 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 4Y4FBn6SXXz5g5p3; Fri, 06 Dec 2024 02:12:17 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4FBn5yBtz43Ql; Fri, 6 Dec 2024 02:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733451137; 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=LC5A1XVfUqI9pVpgiOinCf6QxK4RXi/0GnTCEVBSBtA=; b=VZXGzq/Daejhy7H+77SxL0sunSOiiya84CMAzYt0a3WPvIJzK3w3ShQZpMQc15IG4uyqGB 2REK+scrYRGYeHXl+11wbu+ziqgcJiM2DofkAqyfXZoIIzJIElLUJJ356HcL9u0WaArrOA gxExN2JrCSDIL8UZq7nZs6NsQL4gffkfF3JKDN2+yfh6ApzjrjDnOjeLWHCzO4rhC1J66s 7HpZoHBu9BVOOGS08lxC+FsU6agBxqSX/Dk6XcqWhlrsPAKXlMHDhzaFPYpFMBTVlu88/I uzoYJ8AXcwIpwqujTRyase2braT09pdrpgYUyT7SGT9OLh703PRWIfYMPk1Oqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733451137; 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=LC5A1XVfUqI9pVpgiOinCf6QxK4RXi/0GnTCEVBSBtA=; b=ue5JAqPAJtMegdpRNesrOK3wZ+TeSLJzsyh6LY0OQ4ugUDqhxxZyq2BKDeqYXAS4Cx97D9 JN/SfLHD0sON5XBFPUwsP1aildFozyekfmNCBAkQRh/fZPU8kbA2cooVREaw+du4QfkHaD cuDwtPYxLGMTG9KhLNj/AiRSb/NkQj3r11G0Evdp0rICDecUuk3RfNePJZ6dUkxHSYnQvB OyqzQAS53SKZBdiW4FVio09FqpvLTpNOqTD8fJ6A4rhmtIs2VQe36UOUTldv2TkRaFm4o9 el7bF8/QArPHoYg9366RLb2L9M+7QHz+upfIyKrtpHgqHom6DflVySSk09GVfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733451137; a=rsa-sha256; cv=none; b=bbcTuRdTnXl5U0GYkRdKrktWNip0VCAGUu4vkxFhiibPUkPOsDr7Uvgx1TtIHMTmLKpKF3 gFn6Ba7wlfi61TeNEyXJ+gIpbgC3pU9fEu8wk8/DPRcc2Fyz8picvBe2Li/9wwpG2gL8CB SjxA1YaddTSQd5J80mEH1cVA+S0BtSA8zJkgsy1EWg3mBxn/cHnxfqcKldDJHFK22J5IWw /xmlsWYV2ALRKwCK4exo48N/lhJW7l1qCwFjrauOzZoWf33y4zJF9Rc8E1pPsVf8kogMY7 jpi2R1kaOQUZ7JNrHy8rLn7THGEhuvZ9N1XBEu5dFr3xt6vRaKmEm3x3jjh5rg== 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 4Y4FBn5VKFzJb7; Fri, 6 Dec 2024 02:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B62CHhT014630; Fri, 6 Dec 2024 02:12:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B62CH9M014628; Fri, 6 Dec 2024 02:12:17 GMT (envelope-from git) Date: Fri, 6 Dec 2024 02:12:17 GMT Message-Id: <202412060212.4B62CH9M014628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 4db1b113b151 - main - tarfs: Fix the size of struct tarfs_fid and add a static assert 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4db1b113b15158c7d134df83e7a7201cf46d459b Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4db1b113b15158c7d134df83e7a7201cf46d459b commit 4db1b113b15158c7d134df83e7a7201cf46d459b Author: Rick Macklem AuthorDate: 2024-12-06 02:09:27 +0000 Commit: Rick Macklem CommitDate: 2024-12-06 02:11:36 +0000 tarfs: Fix the size of struct tarfs_fid and add a static assert File system specific *fid structures are copied into the generic struct fid defined in sys/mount.h. As such, they cannot be larger than struct fid. This patch packs the structure and checks via a __Static_assert(). Reviewed by: markj MFC after: 2 weeks --- sys/fs/tarfs/tarfs.h | 2 +- sys/fs/tarfs/tarfs_vnops.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/fs/tarfs/tarfs.h b/sys/fs/tarfs/tarfs.h index ff1985e488cd..ffb95d2c0ac5 100644 --- a/sys/fs/tarfs/tarfs.h +++ b/sys/fs/tarfs/tarfs.h @@ -165,7 +165,7 @@ struct tarfs_fid { u_short data0; /* force alignment */ ino_t ino; unsigned long gen; -}; +} __packed; #define TARFS_NODE_LOCK(tnp) \ mtx_lock(&(tnp)->lock) diff --git a/sys/fs/tarfs/tarfs_vnops.c b/sys/fs/tarfs/tarfs_vnops.c index 8c97fab185fc..afb8e05f5929 100644 --- a/sys/fs/tarfs/tarfs_vnops.c +++ b/sys/fs/tarfs/tarfs_vnops.c @@ -668,6 +668,8 @@ tarfs_vptofh(struct vop_vptofh_args *ap) { struct tarfs_fid *tfp; struct tarfs_node *tnp; + _Static_assert(sizeof(struct tarfs_fid) <= sizeof(struct fid), + "struct tarfs_fid cannot be larger than struct fid"); tfp = (struct tarfs_fid *)ap->a_fhp; tnp = VP_TO_TARFS_NODE(ap->a_vp);