NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

install/58343: Root directory record in the Primary volume descriptor of NetBSD iso images uses non-standard/broken datetime format



>Number:         58343
>Category:       install
>Synopsis:       Root directory record in the Primary volume descriptor of NetBSD iso images uses non-standard/broken datetime format
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 13 23:25:00 +0000 2024
>Originator:     Adam Vodopjan
>Release:        Tested with 8.3, 9.1 to 9.4, 10.0 amd64 iso images
>Organization:
>Environment:
Not relevant
>Description:
According to the iso9660/ecma-119 spec:
- at offset 32768 there is the Volume Descriptor Set, VDS
- inside VDS there must be a Primary VD, PVD
- inside PVD, at offset 156 there is the Root Directory Record, RDR
- inside RDR, at offset 18 there is a 7-bytes datetime field in format
specified in ecma-119, section 9.1.5

The offsets and data structures are outlined in sys/fs/cd9660/iso.h

Usually, the first VD in VDS is of PVD type. So, usually, at offset 32942 there
is a 7-bytes datetime field. The format is very plain (starting from the lowest
address byte):
- number of years since 1900
- month, 1..12
- day, 1..31
- hour, 0..23
- minute, 0..59
- second, 0..59
- time zone in 15 min intervals, -48..52

For example, Thu Jun 13 08:55:38 PM UTC 2024 would be:
    124 6 13 8 55 38 0

In usr.sbin/makefs/cd9660/cd9660_conversion.c there is cd9660_time_915()
function which converts timestamps to this format.

Let's declare such shell function:
    dump_rdr_date() {
        od -j$((2048*16 + 174)) -N7 -td1 -tc -An
    }

and explore some iso images (checkout Appendix 1 to replicate the sample set).
The output is for GNU od, it is well aligned.

    > for iso in *.iso; do echo "$iso"; dump_rdr_date < "$iso"; done
    debian.iso
      123    6   10    8   51   17    0
        {  006   \n   \b    3  021   \0
    fedora.iso
      123    4   13   22   15   10    0
        {  004   \r  026  017   \n   \0
    freebsd.iso
      123   11   10    9   32   53    0
        {   \v   \n   \t         5   \0
    NetBSD-10.0-amd64.iso
       49   55   50  100   56  100  101
        1    7    2    d    8    d    e
    NetBSD-8.3-amd64.iso
       56   54   57   56   57   52   99
        8    6    9    8    9    4    c
    NetBSD-9.1-amd64.iso
       48   51   53   55   57   54   52
        0    3    5    7    9    6    4
    NetBSD-9.2-amd64.iso
       97   53   53  101   56   56  102
        a    5    5    e    8    8    f
    NetBSD-9.3-amd64.iso
       97   53   53  101   56   56  102
        a    5    5    e    8    8    f
    NetBSD-9.4-amd64.iso
       97   53   53  101   56   56  102
        a    5    5    e    8    8    f
    openbsd.iso
      124    3   20   16   14    1  -24
        |  003  024  020  016  001  350
    opensuse.iso
      124    5   29   19    9   18    0
        |  005  035  023   \t  022   \0
    ubuntu.iso
      122    4   19   10   21   14    0
        z  004  023   \n  025  016   \0

All but the NetBSD datetime look OK. The NetBSD ones look like some (random?)
ASCII hex digits. Besides, the value is the same for 9.2 .. 9.4. Here is a
better overview:

    NetBSD-10.0-amd64.iso
        1    7    2    d    8    d    e
    NetBSD-8.3-amd64.iso
        8    6    9    8    9    4    c
    NetBSD-9.1-amd64.iso
        0    3    5    7    9    6    4
    NetBSD-9.2-amd64.iso
        a    5    5    e    8    8    f
    NetBSD-9.3-amd64.iso
        a    5    5    e    8    8    f
    NetBSD-9.4-amd64.iso
        a    5    5    e    8    8    f


I've found out this problem while testing my tool [1] tailored to dump PVD/SVD
of iso images. There are example dumps [2] for different images. The dump for
NetBSD-10.0-amd64.iso [3] looks OK aside for the datetime field in
root_directory_record.

[1] https://github.com/slowpeek/vddump
[2] https://github.com/slowpeek/vddump/tree/master/examples
[3] https://gist.github.com/slowpeek/68740e21861c567b98521b014c46404d

-- Appendix 1

urls.txt to use as `curl -K urls.txt` to download the first 1M of some iso
images:

    # common options
    -L
    -r 0-1048575

    # netbsd
    url=https://cdn.netbsd.org/pub/NetBSD/images/8.3/NetBSD-8.3-amd64.iso
    -O
    url=https://cdn.netbsd.org/pub/NetBSD/images/9.1/NetBSD-9.1-amd64.iso
    -O
    url=https://cdn.netbsd.org/pub/NetBSD/images/9.2/NetBSD-9.2-amd64.iso
    -O
    url=https://cdn.netbsd.org/pub/NetBSD/images/9.3/NetBSD-9.3-amd64.iso
    -O
    url=https://cdn.netbsd.org/pub/NetBSD/images/9.4/NetBSD-9.4-amd64.iso
    -O
    url=http://cdn.netbsd.org/pub/NetBSD/images/10.0/NetBSD-10.0-amd64.iso
    -O

    # freebsd
    url=https://download.freebsd.org/releases/amd64/amd64/ISO-IMAGES/14.0/FreeBSD-14.0-RELEASE-amd64-dvd1.iso
    -o freebsd.iso

    # openbsd
    url=https://cdn.openbsd.org/pub/OpenBSD/7.5/amd64/install75.iso
    -o openbsd.iso

    # opensuse
    url=https://download.opensuse.org/distribution/leap/15.6/iso/openSUSE-Leap-15.6-DVD-x86_64-Media.iso
    -o opensuse.iso

    # debian
    url=https://cdimage.debian.org/cdimage/archive/12.0.0-live/amd64/iso-hybrid/debian-live-12.0.0-amd64-standard.iso
    -o debian.iso

    # ubuntu
    url=http://old-releases.ubuntu.com/releases/jammy/ubuntu-22.04-desktop-amd64.iso
    -o ubuntu.iso

    # fedora
    url=https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/38/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-38-1.6.iso
    -o fedora.iso

>How-To-Repeat:
Not relevant
>Fix:



Home | Main Index | Thread Index | Old Index