NetBSD Problem Report #58343
From www@netbsd.org Thu Jun 13 23:23:11 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 960951A9238
for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Jun 2024 23:23:11 +0000 (UTC)
Message-Id: <20240613232309.D2EA51A923A@mollari.NetBSD.org>
Date: Thu, 13 Jun 2024 23:23:09 +0000 (UTC)
From: adam.vodopjan@gmail.com
Reply-To: adam.vodopjan@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Root directory record in the Primary volume descriptor of NetBSD iso images uses non-standard/broken datetime format
X-Send-Pr-Version: www-1.0
>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:
(Contact us)
$NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.