From nobody Tue Jun 4 15:46:54 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 4Vtw2P2fhBz5M0QF for ; Tue, 04 Jun 2024 15:47:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 4Vtw2N4smgz43v2 for ; Tue, 4 Jun 2024 15:47:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2c1aa8d302fso3882482a91.1 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=NccidITTENdLss6CrQvxG3H7F/3tWGUROpn1GqtXK+J2+Sr9+DDiJ7fl6AizD4xlJj fbOSRtM/VWp/qgZM2QGagRsi/JB83eou+gtiG0d9SxdPEK7W+dfqmqQy83ez0QOfJ2RA Goi/TkAXL3udw+PVLtzPmJOOW38evdDNphoPCT/9SwkkTvKOfPtIs308OuHueYMph2ki vkQMnwfaep9Wk/9kh20ZCCtyxOLQJZ+KFtKHbCK3lBXRjJ4MFPy1IpCXD9xApvCt32mq WPJFGz7Qp/lqyuYJPU9HZZJYYcDF5OwpDJtMpETBNyJ+YCu/Stwh2WNBwCfhhZfr5tNh jQ3Q== X-Forwarded-Encrypted: i=1; AJvYcCX52pgGeXj4Qk2TBSAaM28HIWpI6CGBoLPX2mKWeNCL/jNyt51VZqG6sV9PjpMjk2g1FvHmXJbN+O94iVL9qZm/A5B42HW3FBDyLd2c2ZVp X-Gm-Message-State: AOJu0YwmmiFZ62t/K2oG1QjuNal1ilRrOqlXgJyedLXsvIhfWv+SNwte Uo9C6Rm1QOpU22ExczLgHpGUhVyQJ6gWelgkIHGw7Zbei8+uegnKidps4ex+BB6fylHQVccYIjQ 8l0defQ1aEvtydY7BX/kM1TnyJvlJQuK0Qq0Vfw== 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 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: <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: 4Vtw2N4smgz43v2 --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--