Page MenuHomeFreeBSD

makefs: Ensure that FFS superblocks are reproducible
ClosedPublic

Authored by markj on Tue, May 6, 3:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, May 27, 6:00 AM
Unknown Object (File)
Mon, May 26, 4:32 PM
Unknown Object (File)
Fri, May 23, 9:40 PM
Unknown Object (File)
Thu, May 22, 8:20 PM
Unknown Object (File)
Sun, May 11, 8:40 AM
Unknown Object (File)
Sun, May 11, 7:45 AM
Unknown Object (File)
Sat, May 10, 7:46 AM
Unknown Object (File)
Sat, May 10, 7:43 AM
Subscribers

Details

Summary

The superblock structure has space reserved for a pointer to an
in-memory structure that gets created at mount time. makefs populates
it since that simplifies code elsewhere. However, the pointer value
ends up in the output file, which breaks reproducibility.

Zero the field instead, as its on-disk value is ignored.

Sponsored by: Klara, Inc.
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 63946
Build 60830: arc lint + arc unit

Event Timeline

markj requested review of this revision.Tue, May 6, 3:53 PM

Fine with me (even if it does seem a little strange to zero fs_si, copy, and then restore it).
Out of curiosity what do we do in kernel ffs?

This revision is now accepted and ready to land.Tue, May 6, 4:44 PM

Fine with me (even if it does seem a little strange to zero fs_si, copy, and then restore it).

At first I tried not populating it at all, but that introduces a bunch of complexity elsewhere.

Out of curiosity what do we do in kernel ffs?

The on-disk value seems to be ignored. ffs_sbget() allocates the summary info structure and glues it into the returned superblock structure, overwriting whatever happened to be on disk.

This has been fixed in newfs for some time. Along with numerous other changes like checkhash validations, superblock integrity checks, and other fixes and improvements. In my opinion makefs/ffs should just use use newfs/mkfs.c rather than (poorly) trying to parody it.