Page MenuHomeFreeBSD

mkimg: Add a reproducible mode
ClosedPublic

Authored by markj on Apr 8 2025, 9:49 PM.
Tags
None
Referenced Files
F128416879: D49716.id157599.diff
Wed, Sep 10, 4:13 PM
F128370094: D49716.id153368.diff
Wed, Sep 10, 6:37 AM
F128369919: D49716.id153368.diff
Wed, Sep 10, 6:35 AM
F128349708: D49716.id157665.diff
Wed, Sep 10, 3:11 AM
F128340563: D49716.diff
Wed, Sep 10, 1:23 AM
F128333961: D49716.id157665.diff
Tue, Sep 9, 11:57 PM
F128331754: D49716.id157519.diff
Tue, Sep 9, 11:27 PM
Unknown Object (File)
Tue, Sep 9, 12:28 AM

Details

Summary

Merge the FreeBSD-specific implementation of osdep_uuidgen() with that
of Linux. While the latter is more complex, it lets us ensure that the
returned UUIDs are reproducible.

This mainly affects the UUID embedded in the GPT header.

Diff Detail

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

Event Timeline

markj requested review of this revision.Apr 8 2025, 9:49 PM
usr.bin/mkimg/uuid.c
62

We could (also) check SOURCE_DATE_EPOCH here

usr.bin/mkimg/uuid.c
62

There are random(3) calls below, which is why I didn't do that here, but mkimg wasn't seeding the PRNG so I believe they are effectively deterministic anyway (modulo random(3) implementation being the same).

Handle SOURCE_DATE_EPOCH.

Remove SOURCE_DATE_EPOCH handling per some earlier discussions.
Just using a fixed timestamp for UUIDs is good enough.

usr.bin/mkimg/mkimg.1
25
markj marked an inline comment as done.

Update Dd

This revision is now accepted and ready to land.Jun 25 2025, 2:17 PM
This revision was automatically updated to reflect the committed changes.

Hmm. It was probably a mistake to do it this way. I should have added a timestamp option, like makefs has with -T. There is one other place I missed, in the VHD footer, where we need a timestamp, and since it's part of the image metadata, it's probably not ideal to hard-code a single value.

I'll post a patch which removes -R and instead adds an explicit timestamp option. Unfortunately, -T is already taken.