From nobody Wed Jun 05 23:46:14 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 4Vvkd03MzNz5MGGT; Wed, 05 Jun 2024 23:46:28 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (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 4Vvkcz5Nqlz4FWr; Wed, 5 Jun 2024 23:46:27 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=GJKG7ZBt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::62d as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1f44b441b08so3293775ad.0; Wed, 05 Jun 2024 16:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717631186; x=1718235986; darn=freebsd.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=/KOQhQ4oLQ+r0F0Afq1dLQ34yQPksEtZaj2l9L2bdJ0=; b=GJKG7ZBtuy+UKdW0eu/U0x7Nqwoa5r90/44ZHSwUpZhxGiTt3E8h3ZwJh8ppuKrYZ5 Ux8MIzspuN0y6PMKG+9v5vXuH+EF/l4srWYliyOiUzP2ZNkXUS5xoeZaRdFU2NTKBcRM Av8phbzNgDgiecLzcILiUH2OR8vTX8Yka1P5p7NkEoQNYh9aPoWjBgvT4jB/B48J1xGH /w+XBdUV0PG/jj02SYSVk/yjUUYKjpIeGRqf+ERPh/0b+AylHoygyUZOsJhM7uM3Ki/A ltsttkp/PyCnpPsLBWl96wpNLntCpmJeONkZOCs2LgYoA93FMoKARggIAhD4RYh05ZnD T+kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717631186; x=1718235986; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/KOQhQ4oLQ+r0F0Afq1dLQ34yQPksEtZaj2l9L2bdJ0=; b=iML731XJGY3cgW0LgLG+DmRsjvWJ+FayaxieMmiiPskmp3uFEZxH6P5gY4KwhqZihh glARq+qclCMfyB5413BjdX2CKQsOEy7l131X5IpTvzopS36bdfZl000Ht5M2CBIw/1GW qATDyEWT1P+ahd62HMjdeVKoXjmaDJn8loNKQHgyB7iRYF/ao0IZnZx5rEVyIeeGfycf tcDmbMIVRLZ8/EMKlyBrWcsMBUD9i+AoptluqLv55nmhG/Od8U+0WX2bV8YhzlHSzFdm +ghtQilz69Davkzg7pLLq4XhqR4vbWivbBrIj4sAKNzrpt1BX9Krxac38HhNbZbazl0b ds/g== X-Forwarded-Encrypted: i=1; AJvYcCXSa4QHK1YA3svnf0Uv4z26zWptqK0ZOeG+ifGJNZtZeobO4LoLf8o/EObK3gXj8SUKnPhQqzvtLmlwokqos/XPqBpDKb4nsUTXcw2077Qrv4xoZ0de3w3Y2Qf4WETypA3boNrp5QQWU5XqutR14EzSz+WpmNU6maTIf+rQdxFxcZynimkt+6oRBzs4sGo= X-Gm-Message-State: AOJu0YzcqK1C0VrEfCkna/ClGIiCv1ibMEkiyNYe05ONNAR8RSnCTh7T 55mxTUJ7hfnS2M6xKD/zgzpUlwcnTsJRfQf56SbtctQHKhv2PaRNgDYz6g== X-Google-Smtp-Source: AGHT+IHc8honSZay/iY/xRBEiHKjfg2TXAU4Mgh7cG1e3sRVohHG5gnOPrbAnyqkpFsi8PZSN0IQsw== X-Received: by 2002:a17:902:e810:b0:1f6:7f45:4d37 with SMTP id d9443c01a7336-1f6a5a7b54emr44960365ad.66.1717631185671; Wed, 05 Jun 2024 16:46:25 -0700 (PDT) Received: from smtpclient.apple ([162.118.1.182]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7d2cb8sm1106535ad.140.2024.06.05.16.46.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2024 16:46:25 -0700 (PDT) From: Enji Cooper Message-Id: <85B47B24-68AA-4555-9D70-E89FC296ACA0@gmail.com> Content-Type: multipart/signed; boundary="Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D"; protocol="application/pgp-signature"; micalg=pgp-sha256 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 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems Date: Wed, 5 Jun 2024 16:46:14 -0700 In-Reply-To: Cc: =?utf-8?Q?Stefan_E=C3=9Fer?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org To: Shawn Webb References: <202406040628.4546SJ98088668@gitrepo.freebsd.org> X-Mailer: Apple Mail (2.3774.600.62) X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.28 / 15.00]; SIGNED_PGP(-2.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; MIME_GOOD(-0.20)[multipart/signed,multipart/alternative,text/plain]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; NEURAL_HAM_SHORT(-0.18)[-0.183]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:~]; TO_DN_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::62d:from]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_ATTACHMENT(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; APPLE_MAILER_COMMON(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-Rspamd-Queue-Id: 4Vvkcz5Nqlz4FWr --Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D Content-Type: multipart/alternative; boundary="Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC" --Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jun 4, 2024, at 8:21=E2=80=AFAM, Shawn Webb = wrote: >=20 > On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=C3=9Fer wrote: >> The branch main has been updated by se: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb= 60fa486a >>=20 >> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a >> Author: Stefan E=C3=9Fer >> AuthorDate: 2024-06-04 06:26:09 +0000 >> Commit: Stefan E=C3=9Fer >> CommitDate: 2024-06-04 06:26:09 +0000 >>=20 >> newfs_msdos: fix build on non-FreeBSD systems >>=20 >> Disable data area alignment if the build environment does not = define >> PAGE_SIZE (e.g., when building on Linux or macOS). >>=20 >> Reported by: jrtc27 >> MFC after: 1 week >> --- >> sbin/newfs_msdos/mkfs_msdos.c | 4 ++++ >> 1 file changed, 4 insertions(+) >>=20 >> diff --git a/sbin/newfs_msdos/mkfs_msdos.c = b/sbin/newfs_msdos/mkfs_msdos.c >> index 423fbbcadcc5..1bca560a59e1 100644 >> --- a/sbin/newfs_msdos/mkfs_msdos.c >> +++ b/sbin/newfs_msdos/mkfs_msdos.c >> @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, = const struct msdos_options *op) >> if (o.align) >> alignto =3D bpb.bpbSecPerClust; >> else >> +#ifdef PAGE_SIZE >> alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec; >> +#else >> + alignto =3D 1; >> +#endif >=20 > Imagine the following: >=20 > 1. someone builds FreeBSD on Linux or macOS > 2. that build is deployed > 3. FreeBSD is rebuilt on that deployment >=20 > Could the value of alignto be different on step 1 versus step 3? Hi Shawn, Assuming the tool is built for the host, yes it would run into = the issues you=E2=80=99re describing. If it=E2=80=99s targeting FreeBSD = though or an OS that allows direct access to PAGE_SIZE, e.g., NetBSD, it = will use whatever the OS defines for PAGE_SIZE in the appropriate = headers. Cheers, -Enji= --Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Jun 4, = 2024, at 8:21=E2=80=AFAM, Shawn Webb <shawn.webb@hardenedbsd.org> = wrote:

On Tue, Jun 04, 2024 at = 06:28:19AM +0000, Stefan E=C3=9Fer wrote:
The branch main has been updated by = se:

URL: = https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb= 60fa486a

commit = 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
Author: =     Stefan E=C3=9Fer = <se@FreeBSD.org>
AuthorDate: 2024-06-04 06:26:09 = +0000
Commit:     Stefan E=C3=9Fer = <se@FreeBSD.org>
CommitDate: 2024-06-04 06:26:09 = +0000

   newfs_msdos: fix build on non-FreeBSD = systems

   Disable data area alignment if the = build environment does not define
   PAGE_SIZE (e.g., = when building on Linux or macOS).

   Reported by: =    jrtc27
   MFC after: =      1 = week
---
sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
1 file changed, = 4 insertions(+)

diff --git a/sbin/newfs_msdos/mkfs_msdos.c = b/sbin/newfs_msdos/mkfs_msdos.c
index 423fbbcadcc5..1bca560a59e1 = 100644
--- a/sbin/newfs_msdos/mkfs_msdos.c
+++ = b/sbin/newfs_msdos/mkfs_msdos.c
@@ -571,7 +571,11 @@ mkfs_msdos(const = char *fname, const char *dtype, const struct msdos_options *op)
    if = (o.align)
= = alignto =3D bpb.bpbSecPerClust;
    else
+#i= fdef = PAGE_SIZE
alignto =3D PAGE_SIZE / = bpb.bpbBytesPerSec;
+#else
+       = ;  alignto =3D 1;
+#endif

Imagine the following:

1. someone builds FreeBSD on Linux or = macOS
2. that build is = deployed
3. FreeBSD is rebuilt on = that deployment

Could = the value of alignto be different on step 1 versus step 3?

Hi Shawn,
Assuming = the tool is built for the host, yes it would run into the issues = you=E2=80=99re describing. If it=E2=80=99s targeting FreeBSD though or = an OS that allows direct access to PAGE_SIZE, e.g., NetBSD, it will use = whatever the OS defines for PAGE_SIZE in the appropriate = headers.
Cheers,
-Enji
= --Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC-- --Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZg+MYACgkQGpE5DjPs NJgVZw//f4jLnazWQNSST4wnOzyrxH0FtwtekOFOrpqyYYCXjdC4nxNUBWAPe75J x+SMcbeG3k3Tq889FYbOc9YYFyOkYxPLf2xPAYSU6Vfu2gy6Q2yIAtsYiugsx1SV RKLwhBJO1n0E8bABj9VMlrZrfcmxcl+aIa7sS+1m1xMi40kchgRVwjDUId1AcUf+ 6XAn9TiRnB6J454CH7c5oErQPgzL6/23354Q50FryC3K/bW+BGg7Ia5AU6Yi7Dhz P+3RAZ0nz14Is/8tndk71vsqWMbcsUg3L0U8aoHATvPyppjRcX2F8AxOk2JjQq7/ jLO7wBjZLK1RCSDvBLt/DYdCJngkOU3p/mWNQosS5Jpk4hR/QSqFY0VSaJh75Vqb AU0asmHFWGEvoALFIZwli1NBOSDvTZ7UztnIxRiPbkQCP+SfiwVEC855ULEBXsPD MvtyMob60+ycsdgm5UXUHsX4IJ16AEPHCLE8KDc1NGNe+iygtHp1yhxi/Gmf9DHf YbB3hJBYO3Yxr+Nj01CLqreV4SeSxhhcg2mUVCQlu4SaK06aH3ZexnLK7qgGUowh Xt0lYxxuPV4Q7J11oSueFkUG83hTUnsj8Bp6dORqq0ds/agO0q9kKATdIR92BLE4 6KQXdSJjydHE2GVHq4Jkkrn9XFv9ifOAe0fs3bXp7xDGlB3G5h8= =lp/s -----END PGP SIGNATURE----- --Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D--