From nobody Fri Jan 17 13:53:08 2025 X-Original-To: dev-commits-src-branches@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 4YZLm50PBPz5l1D6; Fri, 17 Jan 2025 13:53:09 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZLm468Bhz3nsG; Fri, 17 Jan 2025 13:53:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737121988; 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=jELqylI9CwVxayUCppTWbvOC9vo5QAHCeAaMHslmoNM=; b=jMv9il00owNhZZ3nozNNNOKFmLqxxbqoO6sQR8Cl1zPdx5HJRQ66i0SVMAo1Vgc9hzTez7 VtnR74WGoBrsH4sVL9PZO+VgPGF4Emra0e6ayABhMMtfSMlxIjTD75RyydrH7uK2hFpU1s m7JWJofZZKZP8Eypfy9Gi9C67m6mFmTBnM7aGyzoicTrI8G9YRZTmLljOq/ozLi9i/8+ie 8haCHxWH45+cPRiO/ynn6smGGzBYU3AHZjqqCIoRa6Zs8Q3ts/0dzU/nS1/3K+rlIUAjli Ur5df0cYkaTWpeo80a85/B4OFlvClCKUyA1BZ9XGV7au0z3+hVIpR3uiTnwBMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737121988; 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=jELqylI9CwVxayUCppTWbvOC9vo5QAHCeAaMHslmoNM=; b=LTu08wC1mEZQqcQim0fLXSWWntmSMvQOtfDybi8SuFsHJlRphpzWK6jP3aG14OrdnXSBb+ C/qOuXHe4YRbDLbClb8OKVlOPxFgNxdFJyN7/hb3J3F9Gxuaow2mkEMTkExxc1jCVBWdZX IRGHp3NRp5DDfj7RaRAxZWjkCwI5AfEGNJbgHi9Hz7jVI/4zOSFyYCATs7K7WqxPhK7rTk iJK2rb16y7vl2ioaB+XFpWDTa/rUbxhWGmD0sR8k7jJ5SIXS7fX7uhXqS+tbZeHQ+a+kJA suUMG6Acpvmnb2u3scfw0HdvOqlPnaU0PkM8B3+BXIaHC7GTYuoNVypRV5UHsA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737121988; a=rsa-sha256; cv=none; b=bFN2Kj4vO+chjjxg/X+4P0Ge6Ldu50obugm+rCyAfVh/fXy9jqc1hztgeXbcWJBcNSOQDl rvA5HQm85V44ZZ7M1CfOwUF6qOxeau/BhSZByNJAyGtZVmkGvM0O74Cd0Jj1c5rfTxgw0m 0PmhEPM+OVsNY8KJZeuDvrj/r1afcTg3zBjCZecOUj0O8RfIJ65DSaAISx8zANEQLL+t+B dL4nHOvn0uitLt2Yk5WvYnA5Gt3aDwsm1/evhOFUMu1Ywm0FXBD7OXt1PpRFe7Rs7Qw5pl 0JX7B4f1b4rRx4yRAFLtH5UsMUpMkkbKqCmaDgcAwNajzOjS/4j3Ub43ZHfFFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YZLm45gh8z5YR; Fri, 17 Jan 2025 13:53:08 +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 50HDr8Hk022443; Fri, 17 Jan 2025 13:53:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HDr8ae022440; Fri, 17 Jan 2025 13:53:08 GMT (envelope-from git) Date: Fri, 17 Jan 2025 13:53:08 GMT Message-Id: <202501171353.50HDr8ae022440@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 155987e20190 - stable/14 - tarfs: Fix the size of struct tarfs_fid and add a static assert List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 155987e2019089a5bd2eef77ed7bcc5cc26c362e Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=155987e2019089a5bd2eef77ed7bcc5cc26c362e commit 155987e2019089a5bd2eef77ed7bcc5cc26c362e Author: Rick Macklem AuthorDate: 2024-12-06 02:09:27 +0000 Commit: Olivier Certner CommitDate: 2025-01-17 13:50:46 +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 (cherry picked from commit 4db1b113b15158c7d134df83e7a7201cf46d459b) --- 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);