Bug 285630 - makefs: cd9660 RockRidge extensions ignore timestamp provided by -T
Summary: makefs: cd9660 RockRidge extensions ignore timestamp provided by -T
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Bojan Novković
URL: https://reviews.freebsd.org/D49488
Keywords:
Depends on:
Blocks: 236081
  Show dependency treegraph
 
Reported: 2025-03-24 15:48 UTC by Bojan Novković
Modified: 2025-05-20 09:51 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bojan Novković freebsd_committer freebsd_triage 2025-03-24 15:48:41 UTC
The cd9660 RockRidge extensions specify a TX record that stores the timestamp from the underlying inode. However, makefs' implementation of the TF record ignores a timestamp passed using the -T flag, making the resulting ISO image nonreproducible.

This issue can be observed in the top-level directories by running 'diffoscope' on two 'bootonly.iso' images that have been built back-to-back with a fixed timestamp ('-T 1742574909'):

|  drwx------  18        0        0     4096 2025-03-21 16:35:09.000000 .
│ -drwxr-xr-x   2        0        0     6144 2025-03-24 14:48:55.000000 bin
│ --r-xr-xr-x   6        0        0        - 2025-03-24 14:48:55.000000 bin/cat
│ --r-xr-xr-x   6        0        0        - 2025-03-24 14:48:55.000000 bin/chflags
--snip--
| +drwxr-xr-x   2        0        0     6144 2025-03-24 14:57:38.000000 bin
│ +-r-xr-xr-x   6        0        0        - 2025-03-24 14:57:38.000000 bin/cat
│ +-r-xr-xr-x   6        0        0        - 2025-03-24 14:57:38.000000 bin/chflags

The dot directory record has the appropriate timestamp set, but the rest of the directories do not.
Comment 1 commit-hook freebsd_committer freebsd_triage 2025-05-20 09:51:51 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=964b0ece795a4e2c811753873bf6883ffb160af8

commit 964b0ece795a4e2c811753873bf6883ffb160af8
Author:     Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2025-03-25 12:54:17 +0000
Commit:     Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2025-05-20 09:50:31 +0000

    makefs: Add tests for the -T flag

    Add tests for the -T flag to each makefs backend. This includes tests
    for both mtree and directory scan options.

    PR:             285630
    Sponsored by:   Klara, Inc.
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    markj, emaste, kevans, jlduran
    Differential Revision:  https://reviews.freebsd.org/D49492

 usr.sbin/makefs/tests/Makefile                    |   2 +
 usr.sbin/makefs/tests/makefs_cd9660_tests.sh      |  78 +++++++++++++
 usr.sbin/makefs/tests/makefs_ffs_tests.sh         |  77 ++++++++++++
 usr.sbin/makefs/tests/makefs_msdos_tests.sh (new) | 136 ++++++++++++++++++++++
 usr.sbin/makefs/tests/makefs_tests_common.sh      |   7 ++
 usr.sbin/makefs/tests/makefs_zfs_tests.sh         |  80 +++++++++++++
 6 files changed, 380 insertions(+)
Comment 2 commit-hook freebsd_committer freebsd_triage 2025-05-20 09:51:52 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fba91af3b09b0cb021a50da2bc78e44dfd49b69a

commit fba91af3b09b0cb021a50da2bc78e44dfd49b69a
Author:     Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2025-03-24 15:47:35 +0000
Commit:     Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2025-05-20 09:50:22 +0000

    makefs: Honor -T timestamps when creating images from mtree manifests

    makefs backends rely on the fsnode structure to derive most
    of the information about the underlying filesystem objects.
    Depending on how the image is built, the fsnode structures
    are initialized in the walk_dir or read_mtree functions.
    However, read_mtree fails to take timestamps passed by -T into account,
    leading to nonreproducible images in backends that do not check for -T.
    Fix this and make -T backend-agnostic by adding an appropriate check
    in read_mtree_keywords while making sure that mtree entries can
    still override -T timestamps.

    PR:             285630
    Sponsored by:   Klara, Inc.
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    markj, emaste
    Differential Revision:  https://reviews.freebsd.org/D49531

 usr.sbin/makefs/makefs.8 |  8 ++++++--
 usr.sbin/makefs/makefs.c | 16 ++++++++++++++++
 usr.sbin/makefs/makefs.h |  1 +
 usr.sbin/makefs/mtree.c  | 19 ++++++++++++++++---
 usr.sbin/makefs/walk.c   | 16 ++--------------
 5 files changed, 41 insertions(+), 19 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-05-20 09:51:53 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1e904d6742bbed99387cc6bcb00dc088192f65df

commit 1e904d6742bbed99387cc6bcb00dc088192f65df
Author:     Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2025-04-01 11:12:39 +0000
Commit:     Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2025-05-20 09:50:27 +0000

    makefs: Remove redundant 'stampst' checks in several backends

    PR: 285630
    Sponsored by: Klara, Inc.
    Sponsored by: The FreeBSD Foundation
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D49601

 usr.sbin/makefs/ffs.c                 | 6 ++++--
 usr.sbin/makefs/msdos/msdosfs_vnops.c | 2 --
 2 files changed, 4 insertions(+), 4 deletions(-)