Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems
- In reply to: Shawn Webb : "Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Jun 2024 15:46:54 UTC
On Tue, Jun 4, 2024 at 9:22 AM Shawn Webb <shawn.webb@hardenedbsd.org> wrote: > On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan Eßer wrote: > > The branch main has been updated by se: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=41ee91c64f47faaa8131df3cd8a63bdb60fa486a > > > > commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a > > Author: Stefan Eßer <se@FreeBSD.org> > > AuthorDate: 2024-06-04 06:26:09 +0000 > > Commit: Stefan Eßer <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 = bpb.bpbSecPerClust; > > else > > +#ifdef PAGE_SIZE > > alignto = PAGE_SIZE / bpb.bpbBytesPerSec; > > +#else > > + alignto = 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/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc >