From nobody Tue Jun 04 15:46:54 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 4Vtw2N74j6z5M0Xy for ; Tue, 04 Jun 2024 15:47:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (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 4Vtw2N4Ky5z43gr for ; Tue, 4 Jun 2024 15:47:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-681bc7f50d0so4111824a12.0 for ; Tue, 04 Jun 2024 08:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1717516027; x=1718120827; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Hh2j0I2ssvf0kZA/+15d8GSh3vo3k1RM9AsMvI88CoQ=; b=HIsn86h4rRTpJM1r/edeSMvMdiaYlwTfPd+KquIHOW1y6ie31CAFOTAzU4uyvh+qPS 1Q7MqnS/e4VzSH1TWCfMNCos6L31DAdNgG0R7DcJOck3BNZ/ojsH2jop7ClnGFzEOB/6 6ZrUttB7EZL6GgNsKSOaQ9jFDL3E+LXK2csBJUrLN8H4u2je7Yh0qkOac4jD2ZzDn0/Y /ade421xpM6V4DSiaKYyUYYsau4Hp9inTOjAavDBBfJ/nwAdRGcTt4PI8+K6JvCD2zTD Oel8zYl7uqSn4nnxANOA0wrVjSXn+YKPGrzjhq12oEpijv2RDRb9IPhawDCBQXYl055B 86QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717516027; x=1718120827; h=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=Hh2j0I2ssvf0kZA/+15d8GSh3vo3k1RM9AsMvI88CoQ=; b=jPXjTjQdiDBqmUgU1M/jyotqEY8SOA2qRGaTVcBVBIJMS7f1oI2KLtXqW0e9GxXhme fMdx9y7jjIA2gRKcpJOnnsYjmrnFEVbeGuA/CwxHxir4mEs4Nb+tMsrj7kytnS//MXxU xR1TtaLJXP6MUjtHKx3EBIPRzb+AsKb8824UCgu6MOJUJDNSY/IV1Q6t+o1YSbSdBu1k fQ2/yJNq4BRMVyaMeRuOQ981i0Q7RIX/umFPUAAyLUtwgZ2Nwpl8iIvs5JWMWovsMM0F zK7RKXk9AuilHAE525XqKbPYtPUe0F1TucDhxZjHqxJerJ4xA0lzqv3z6fFXmG/IvgTW VwCQ== X-Forwarded-Encrypted: i=1; AJvYcCWr41qmzAM2yVRUDTL/VeIDkOfHSYH17fp66JOxfUb9O0CBPXUOMqGqZXN1ele5QSorrGkkh5kxtkOGayXy7tM6NGPA0usA5nSoKFaa4Khs5w== X-Gm-Message-State: AOJu0Yy00ncZgdEn1dxLOYCcukNqiHLmj+Hd1gtNxwOEUiBbShJeLXfM TyPc8XA3qrDQET/BheGw8vAZzSZyC50GDuZfqNqYyTM9jZ+WN5HEtBScpYDFss9rV1kmcabSf2B 05UYxnAKu/2V8P4Zm4ewdRuv1tSZq4FWu7rh96DuAZDeM3Zv8hic= X-Google-Smtp-Source: AGHT+IHIjADzAwrHgc9LFrhMsUUqthGP46wi0+P370OF9keqw/PyMrDAaPr91Ft/hL1ytRCj56kpiuAT9ZzqiceO/UU= X-Received: by 2002:a17:90a:ce8d:b0:2c1:e9db:92c8 with SMTP id 98e67ed59e1d1-2c2530778famr4408811a91.12.1717516027045; Tue, 04 Jun 2024 08:47:07 -0700 (PDT) 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: <202406040628.4546SJ98088668@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Tue, 4 Jun 2024 09:46:54 -0600 Message-ID: Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems To: Shawn Webb Cc: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000b0449b061a125c4d" X-Spamd-Bar: ---- 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:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Vtw2N4Ky5z43gr --000000000000b0449b061a125c4d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 4, 2024 at 9:22=E2=80=AFAM Shawn Webb 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=3D41ee91c64f47faaa8131df3cd8a63bd= b60fa486a > > > > 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 > > > > newfs_msdos: fix build on non-FreeBSD systems > > > > Disable data area alignment if the build environment does not defin= e > > 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 > > +#ifdef 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 > So this is due to makefs pulling this code in. That's built both as a host tool and as a normal target tool. The former is only used to make make release work, iirc and will create small MSDOS images for EFI, where the code in question likely doesn't matter. The latter is also used for the target program newfs_msdos, which is used generically on a FreeBSD system to make a filesystem. That program will have been built with the target's PAGE_SIZE, so is fine. There might be slight differences in images generated without the -a flag, but even then the release images are just used for the installer where minor differences like this won't matter. So newfs_msdos: Same no matter how built. FreeBSD release image: Minor, trivial variation, maybe, in the created image. We don't guarantee 100% reproducible images in general just yet. Warner Could the value of alignto be different on step 1 versus step 3? > > Thanks, > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50 > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/0= 3A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > --000000000000b0449b061a125c4d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Jun 4, 2024 at 9:22=E2=80=AFA= M Shawn Webb <shawn.webb@h= ardenedbsd.org> wrote:
On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=C3=9Fer wr= ote:
> The branch main has been updated by se:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb60fa486a<= /a>
>
> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
> Author:=C2=A0 =C2=A0 =C2=A0Stefan E=C3=9Fer <se@FreeBSD.org>
> AuthorDate: 2024-06-04 06:26:09 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Stefan E=C3=9Fer <se@FreeBSD.org>
> CommitDate: 2024-06-04 06:26:09 +0000
>
>=C2=A0 =C2=A0 =C2=A0newfs_msdos: fix build on non-FreeBSD systems
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Disable data area alignment if the build environmen= t does not define
>=C2=A0 =C2=A0 =C2=A0PAGE_SIZE (e.g., when building on Linux or macOS).<= br> >=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Reported by:=C2=A0 =C2=A0 jrtc27
>=C2=A0 =C2=A0 =C2=A0MFC after:=C2=A0 =C2=A0 =C2=A0 1 week
> ---
>=C2=A0 sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
>=C2=A0 1 file changed, 4 insertions(+)
>
> diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msd= os.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)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (o.align)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =3D bpb.= bpbSecPerClust;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else
> +#ifdef=C2=A0 =C2=A0 =C2=A0 =C2=A0PAGE_SIZE
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =3D PAGE= _SIZE / bpb.bpbBytesPerSec;
> +#else
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =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

So this is due to makefs pulling this code in. That's built both as a= host tool and as a normal target tool. The former is only used to make mak= e release work, iirc and will create small MSDOS images for EFI, where the = code in question likely doesn't matter. The latter is also used for the= target program newfs_msdos, which is used generically on a FreeBSD system = to make a filesystem. That program will have been built with the target'= ;s PAGE_SIZE, so is fine.




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

Thanks,

--
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50
https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/m= aster/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
--000000000000b0449b061a125c4d--