From nobody Fri Dec 06 03:15:33 2024 X-Original-To: dev-commits-src-all@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 4Y4Gc36tWxz5gBFm; Fri, 06 Dec 2024 03:15:47 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (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 4Y4Gc33sV0z4B1b; Fri, 6 Dec 2024 03:15:47 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5d0bf77af4dso1609917a12.3; Thu, 05 Dec 2024 19:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733454945; x=1734059745; 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=yVSoyU8AYKI5nJNRLYFnVDxcZozez4xmyfbJmlrL5tw=; b=kWzqpABf0ydihsEay+n0E5ckKwZI+Ej7kmZrguoc9/3tDQ34Q/Qq/QN1Y1YPt0LRAf BpBAL2O0gMtuuWnNUc3wGIuyytHwfiBOyt1THLrMDfSzBQj0Xpx3PSRfwE8cswfTiGlu mPFkN+i+5MKX5f/kBdbeczvOHwGmkGhdVIVl8ZM5L4SLeC8AkGMk8b12J01JvrzQxWy6 ZhQmg9ORAaoSw/3VdrcO792msHc0fgpDYitcFtM6DzNbDTVzqh5Pz/9v1o1AlWWYGmPF eKZLauKUlWobeYOTTtZzZNXvgUKgQmy8ok5MXUja2A5Jfeaui/7r5zdG/wkoQb/mTZF2 M34Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733454945; x=1734059745; 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=yVSoyU8AYKI5nJNRLYFnVDxcZozez4xmyfbJmlrL5tw=; b=mWqUgzv74xGIePtsPfmFHt7tr3ezHfCLPDM8nWItAQuFFtgQvYCL34rp8cK1hIaMZo GQ10K6u8l1Vz+nKlFH2cbe9y9PzI94mEA+6SzEFzyJnwW5JqCfeuMz6h6djtXtuxaJG1 6hshd5P5VsdAhNo/AJR77KV7Jlq3U7xQf7cFIrvL46R7pKZJ3OM9o3/Kbhltq78pzxu0 X0qalu0pbXAvvqQoWhP3CfU5j/ZkAYPVV5FR0KDEpv1Xnu06s5Lus0Q+n65DGzzJy32T iwX6E92x/mvrMC76izLofD7AoovPsqRufHy9p6gk9PKproZ+NAeMLP295fPdmbCBop20 WOiw== X-Forwarded-Encrypted: i=1; AJvYcCUO3EZLIvWY7kP6DwL6Io+pwcjYQdzxyQfWXcbYhtgJKe0SbwQM7qiZ4ytq9dPHGuBbo2TMIp10gZqAUHorzP/zF6zQ@freebsd.org, AJvYcCVZ+nQR95p28Ocx5eo89V/0hTqdsvPof8EtiOKuPFEQEHzf1ZFSIaJZWJuegWEVIW/AFEgxJTPlcrBvIKEwWZI=@freebsd.org, AJvYcCXX4awOUo7JJpdz1u1HWIVrIG3EjuZ3GLbstKWICSxk+bRdvFOcWaO3jz0vmq9eRkkkwNulTlmCYIKfarmfJnEsX5tpFdk=@freebsd.org X-Gm-Message-State: AOJu0YyzDrCgIwj7uP7Osmwyd2+LLw7IQt9TcAr2xEa282bQynw3grhw 6RbygNAesusBxvVpI16HAmTIHom4TfVHzQ7XCUgbwszxh9sCIVyEaQY86Yp9aiNopGt5RMCSABX gkdqOXw9qn0XMsT7UCdxytfjtoctI X-Gm-Gg: ASbGncueIO0vFPNZHux8rgYsumROcyawDj/ddI/hp4BKE0xa/woxwWv4CeaUXuXdxU7 inaO9LhoR/OBzvm0oSsEcpd0bTWoh5qg4BhfP7G06DhwVxGp8BbKvfturhwg= X-Google-Smtp-Source: AGHT+IE0a96feUnBnM/a96kbGSNUhjt5Ef+O99wezXAjrtKNyeHIPtHpX61MwknMeuz2iQMmsQ2Wknh5xWg6CCzr1HE= X-Received: by 2002:a05:6402:320d:b0:5d2:d72a:77e4 with SMTP id 4fb4d7f45d1cf-5d3be7c1248mr1120706a12.28.1733454944720; Thu, 05 Dec 2024 19:15:44 -0800 (PST) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202412060206.4B6266Ja096452@gitrepo.freebsd.org> In-Reply-To: From: Rick Macklem Date: Thu, 5 Dec 2024 19:15:33 -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-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)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4Y4Gc33sV0z4B1b X-Spamd-Bar: ---- 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 and = know the content is safe. If in doubt, forward suspicious emails to IThelp@= 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=3Dbfc8e3308bee23d0f7836d57= f32ed8d47da02627 > > > > 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 structure 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 > > Jess >