From nobody Fri Dec 06 03:17:06 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 4Y4Gdr2FMjz5gB9w; Fri, 06 Dec 2024 03:17:20 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 4Y4Gdq3G1wz4ByG; Fri, 6 Dec 2024 03:17:19 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=OqwVARtJ; spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2a00:1450:4864:20::52e as permitted sender) smtp.mailfrom=rick.macklem@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5d2726c0d45so1895718a12.2; Thu, 05 Dec 2024 19:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733455038; x=1734059838; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=j8ntP2RPb5/bImLyHEcoDCQexrA+/M3FRmqycTRtNKs=; b=OqwVARtJHD2WVxhTmnaGVAjIUTUIitU8ozl5l96kJlbyewo48s1h+bFMkfGP67s4ud UHTPOHLu8OPO4W7v1/L1a/ARGaCmASi0P2Ab8Zm9E0moA7u/ZBCZyCpWQQmqnNAKsbCX zh/dPp7+bBbHWFtQIYUThoq7JLlUiOYX/Jp8i2M51eY6jcU8ziume44cKLOz7v/pj1Nd GHSZOsmRMyh9SdtNdQREyR82dItfrQtcVCICz/3Q9LhdPy79j/PE87fjrl55kNElHc6/ oeJvtifBVPrJNwZHQet1lrzEjPIwHMuAZWqpwHBArPR8GjozNle5Xock1rM2KsusY0l9 8fyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733455038; x=1734059838; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j8ntP2RPb5/bImLyHEcoDCQexrA+/M3FRmqycTRtNKs=; b=ZZ1Z4b+/KkqBLDB54wInKSwmzsrZw1rIDJgYYWcH/2hQwZxc49otRMZMBXVO67paEr y7LcZs4b03Fsv4Ct4CDDUWVVhStJMng0Ri8dd4S7VpMMxjrvM24cqZrz4Jkih33CJEwX UFtCX2JEbhL6GpgzaHBfpiKDAkrVsrPNkZjlT2wi/tVu2nfDI96ofr6EJfOJllO1UBLe n5C1ycUcmumvqlwYOfSumYkZ3U+Ig6j6F9JIAHiMqU75DpMJc34SgbgP9mAyCabuvHou Z0hpInlxcAcBEZYYvVs486PmDWEQna/nDE0RhoR0qPvfCQBR1wCdqgk2+dc/NQJb1dlW 86lg== X-Forwarded-Encrypted: i=1; AJvYcCWlUl3g5KB4u1eq32d8Thd4Hu6WJy/7lDDPE0kDIcpjpmGzDWNa59ZRPvMDjN9sT0Qy0MkBRarDOUGntPz4rck=@freebsd.org, AJvYcCWymVO5UOpjP/m3Ug1NQBQMh7KxvemuZWf1XvFxpTCIHWXZejx0Xx7u9A080uLQyQN5j6rRGGlVGL9Q22KlhcRiX6KW@freebsd.org, AJvYcCXsiugp88zAL8w3BX4/QmUYqrJBL6Hkcl5//tmdkQvrporjiTPUM+NUGHY3e1tmJKxSueX2P9VFMmCq+JDprvdrQdR4YtI=@freebsd.org X-Gm-Message-State: AOJu0YxoAi8ZlLgfxAExEdOX7fNFsv3umT36cBE/Lz5wUUynUC6Y+9bm vTyQlBG0/SzK/0UufQCBVT5qYad1zx7XSzxd3RyjkrgdYvKJvocY4g7C52hbtM8eDmsDZOWi2KW j4LT8SbXEjdrWVztCb3ZIl5NGEjMK X-Gm-Gg: ASbGncsp44fMHJYqFaA+LcUzd46UGJsAVdSMDVjKGamIzc/hEQRLtULVTOg57TPTy1O JY7E0PzeqdBpBygqq8SaSko/+mVTFYixdPEqo6KXRzP54SA7QdAM6kzZlQIc= X-Google-Smtp-Source: AGHT+IF7D2lcEhu6b/gTxSgIUqTyoSBOnJCI6Y5VK8ALZd3e2hTOb40TYC8L4Lp/DEVIzga6UUhZD9idbfaPgR6C5Fs= X-Received: by 2002:a05:6402:2349:b0:5d0:f904:c23d with SMTP id 4fb4d7f45d1cf-5d3be785c74mr1534046a12.28.1733455037814; Thu, 05 Dec 2024 19:17:17 -0800 (PST) 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 References: <202412060206.4B6266Ja096452@gitrepo.freebsd.org> In-Reply-To: From: Rick Macklem Date: Thu, 5 Dec 2024 19:17:06 -0800 Message-ID: Subject: Re: git: bfc8e3308bee - main - ext2fs: Fix the size of struct ufid and add a static assert To: Jessica Clarke Cc: Rick Macklem , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.99 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.988]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::52e:from]; TO_DN_EQ_ADDR_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; MID_RHS_MATCH_FROMTLD(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; DKIM_TRACE(0.00)[gmail.com:+]; FREEMAIL_ENVFROM(0.00)[gmail.com] X-Rspamd-Queue-Id: 4Y4Gdq3G1wz4ByG X-Spamd-Bar: --- On Thu, Dec 5, 2024 at 7:15=E2=80=AFPM Rick Macklem wrote: > > On Thu, Dec 5, 2024 at 6:40=E2=80=AFPM Jessica Clarke wrote: > > > > CAUTION: This email originated from outside of the University of Guelph= . Do not click links or open attachments unless you recognize the sender an= d know the content is safe. If in doubt, forward suspicious emails to IThel= p@uoguelph.ca. > > > > > > On 6 Dec 2024, at 02:06, Rick Macklem wrote: > > > > > > The branch main has been updated by rmacklem: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dbfc8e3308bee23d0f7836d= 57f32ed8d47da02627 > > > > > > commit bfc8e3308bee23d0f7836d57f32ed8d47da02627 > > > Author: Rick Macklem > > > AuthorDate: 2024-12-06 02:05:06 +0000 > > > Commit: Rick Macklem > > > CommitDate: 2024-12-06 02:05:06 +0000 > > > > > > ext2fs: Fix the size of struct ufid 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 packed the structure and checks via a __Static_assert()= . > > > > > > 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(-) > > > > > > 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"); > > > > > > 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. > You can commit such a change if you'd like, as far as I am concerned. > > I suspect few (if any) export ext2fs file systems anyhow, so this structu= re > is unlikely to ever be used. > > There was a discussion on phabricator in D47879 about reordering > entries and the consensus there seemed to be avoid doing that, > although admittedly I think they were referring to the first two fields, > which match the ones in the generic "struct fid". > > rick ps: I used __packed since that was what markj@ used for cd9660, to keep things consistent. > > > > > Jess > >