From nobody Fri Dec 06 02:40:28 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 4Y4Fqb3tvnz5g7W4 for ; Fri, 06 Dec 2024 02:40:43 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4Fqb0mnVz45qf for ; Fri, 6 Dec 2024 02:40:43 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-434a10588f3so10707805e9.1 for ; Thu, 05 Dec 2024 18:40:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733452841; x=1734057641; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8xl1+tsgta8HM0PNwoSa6J1cgb5TjXbOt/onBNA2PZI=; b=Z6fSgC+Bpd27NiFx/POVPw5wpSFUQ+igMZ/w3mjxfBOurTDsEWFwPGA5zz1KCdz4YP 5MCD5qWhwEaLG3p9Mct72qiJfYHh8jagzjevmvm9a2gAywG9sHUIANyhvZMXAvv5CLeE 368YYsLk05bFbfUubOd8bERIiABMEPnZLmLucpLaDbvz4N/I82+/sMWhxGjgFY3VUOYQ Yyljv/fcH/zaHX6M2myLPmTRY/yclcub6UBmYzJxRQePEnnrImWE9/mG0duTLUgjM8jL 6p8IvHjmPuFUpIb2DidkVQnExZI5HaQqYqZ5BXSKLphMDgUHxm8F8ZBL5PUvxiguQazi s6vw== X-Forwarded-Encrypted: i=1; AJvYcCWuWKLBVtfkluoFOvbavrqbkDQdNYGec/LOJ/zaL+bSVfpzXvHjMRRbLtNiaVg3oilf6a9ChCwRfUJ5sd4zGCyTr1yBSg==@freebsd.org X-Gm-Message-State: AOJu0Yw/mjgZTXQlLW0nWbVaEmWQa4mM6PGpaKCdyYbZlMvOEG5ZgFvB Ktj4HrvT82tdCOzTR3bwwIrazzNU/uSAsqY8XN2QxCkwUlMpFsKUdRCLBK4FbPE= X-Gm-Gg: ASbGncuClYAN138HIg5+vsnNuLlqwiMN8m4sUeePWz9cArqJHwdLsKT2RpNpWGTMDXO RHIJAMRbXkE3/tddAGxH+he7I/0aiXFPj1kOY1wow7290vvRO/M1tVH902QXPF6mDkTVR9eaoE+ QEG4Fo4eNTKKXhu0RkqqFfbwds81QHz8yqW0s8KyNXyxtOVAkbhq1OeVcykXHsnNbTL1RsuCq1T opWot9DdWJyaFdkbEVveSrjUehOGVyU9xtTsNKA1wdNp4iY0Gt6k8HABDRb/HdC X-Google-Smtp-Source: AGHT+IEFHf3diYszI19XrXJjMyi3DQneQikgZgNzYeXmWow3TtTbMqKqUyZLdYraR3og9RxBBuHOtA== X-Received: by 2002:a05:6000:707:b0:385:e30a:e0f7 with SMTP id ffacd0b85a97d-3862b36b800mr768699f8f.22.1733452841294; Thu, 05 Dec 2024 18:40:41 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d5281229sm80101665e9.26.2024.12.05.18.40.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2024 18:40:40 -0800 (PST) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3826.200.121\)) Subject: Re: git: bfc8e3308bee - main - ext2fs: Fix the size of struct ufid and add a static assert From: Jessica Clarke In-Reply-To: <202412060206.4B6266Ja096452@gitrepo.freebsd.org> Date: Fri, 6 Dec 2024 02:40:28 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202412060206.4B6266Ja096452@gitrepo.freebsd.org> To: Rick Macklem X-Mailer: Apple Mail (2.3826.200.121) X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Queue-Id: 4Y4Fqb0mnVz45qf X-Spamd-Bar: ---- On 6 Dec 2024, at 02:06, Rick Macklem wrote: >=20 > The branch main has been updated by rmacklem: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dbfc8e3308bee23d0f7836d57f32ed8d4= 7da02627 >=20 > commit bfc8e3308bee23d0f7836d57f32ed8d47da02627 > Author: Rick Macklem > AuthorDate: 2024-12-06 02:05:06 +0000 > Commit: Rick Macklem > CommitDate: 2024-12-06 02:05:06 +0000 >=20 > ext2fs: Fix the size of struct ufid and add a static assert >=20 > 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. >=20 > This patch packed the structure and checks via a __Static_assert(). >=20 > Reviewed by: markj > MFC after: 2 weeks > --- > sys/fs/ext2fs/ext2_vnops.c | 2 ++ > sys/fs/ext2fs/inode.h | 2 +- > 2 files changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c > index dfbb11f75421..064c10bd18b2 100644 > --- a/sys/fs/ext2fs/ext2_vnops.c > +++ b/sys/fs/ext2fs/ext2_vnops.c > @@ -1889,6 +1889,8 @@ ext2_vptofh(struct vop_vptofh_args *ap) > { > struct inode *ip; > struct ufid *ufhp; > + _Static_assert(sizeof(struct ufid) <=3D sizeof(struct fid), > + "struct ufid cannot be larger than struct fid"); >=20 > ip =3D VTOI(ap->a_vp); > ufhp =3D (struct ufid *)ap->a_fhp; > diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h > index 9ee1b5672da6..63102deb10b0 100644 > --- a/sys/fs/ext2fs/inode.h > +++ b/sys/fs/ext2fs/inode.h > @@ -191,7 +191,7 @@ struct ufid { > uint16_t ufid_pad; /* Force 32-bit alignment. */ > ino_t ufid_ino; /* File number (ino). */ > uint32_t ufid_gen; /* Generation number. */ > -}; > +} __packed; Why not just swap ufid_ino and ufid_gen? This will give worse codegen on architectures that don=E2=80=99t assume fast unaligned access. Jess