NetBSD Problem Report #59783
From www@netbsd.org Sat Nov 22 15:44:09 2025
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)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 8C2BC1A923A
for <gnats-bugs@gnats.NetBSD.org>; Sat, 22 Nov 2025 15:44:09 +0000 (UTC)
Message-Id: <20251122154408.201A01A923C@mollari.NetBSD.org>
Date: Sat, 22 Nov 2025 15:44:08 +0000 (UTC)
From: adrian@freebsd.org
Reply-To: adrian@freebsd.org
To: gnats-bugs@NetBSD.org
Subject: Can't mount the "special" SGI volume formatted cd9660
X-Send-Pr-Version: www-1.0
>Number: 59783
>Category: kern
>Synopsis: Can't mount the "special" SGI volume formatted cd9660
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 22 15:45:00 +0000 2025
>Last-Modified: Sat Nov 29 21:50:01 +0000 2025
>Originator: Adrian Chadd
>Release: 11.99.4
>Organization:
>Environment:
NetBSD sgimips.home.cacheboy.io 11.99.4 NetBSD 11.99.4 (GENERIC32_IP2x) #0: Fri Nov 21 21:46:20 UTC 2025 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/sgimips/compile/GENERIC32_IP2x sgimips
>Description:
The generated CD images boot fine via:
boot -f scsi(0)cdrom(5)rdisk(0)partition(8)ip2xboot
.. which means the SGI volume label is correct!
But they can't be mounted.
---
sgimips# mount -t cd9660 /dev/cd0a /mnt
mount_cd9660: /dev/cd0a on /mnt: Invalid argument
---
sgimips# svhlabel cd0
16 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 666376 1024 4.2BSD 1024 8192 16 # (Cyl. 1024 - 667399)
c: 670472 0 unused 0 0 # (Cyl. 0 - 670471)
i: 4096 0 unknown # (Cyl. 0 - 4095)
Not updating disk label.
sgimips#
---
sgimips# disklabel cd0
# /dev/rcd0:
type: SCSI
disk: optical media
label: fictitious
flags: removable
bytes/sector: 2048
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 36546
total sectors: 74846208
rpm: 300
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0
16 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 666376 1024 4.2BSD 1024 8192 16 # (Cyl. 0*- 325*)
c: 670472 0 unknown # (Cyl. 0 - 327*)
i: 4096 0 unknown # (Cyl. 0 - 1)
disklabel: partitions a and c overlap
disklabel: partitions a and i overlap
disklabel: partitions c and i overlap
---
>How-To-Repeat:
* boot
* mount -t cd9660 /dev/cd0a /mnt
* see it prints out
---
sgimips# mount -t cd9660 /dev/cd0a /mnt
mount_cd9660: /dev/cd0a on /mnt: Invalid argument
---
* With the below diff, I instead get:
---
# mount -t cd9660 /dev/cd0a /mnt
# ls /mnt
ip2x ip3x sgimips
# mount
/dev/md0a on / type ffs (local)
mfs:107 on /dev type mfs (synchronous, union, local)
/dev/cd0a on /mnt type cd9660 (read-only, local)
---
>Fix:
from mlelstv on irc; I've tested this and it fixes it.
---
adrian@test-3:/data/1/adrian/netbsd/netbsd-src % git diff sys/fs/cd9660
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 6d9e443d5b30..9c2dac42b435 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -419,7 +419,8 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l,
error = VOP_IOCTL(devvp, DIOCGDINFO, &label, FREAD, FSCRED);
if (!error) {
/* XXX more sanity checks? */
- sess = label.d_partitions[DISKPART(dev)].p_cdsession;
+ if (label.d_partitions[DISKPART(dev)].p_fstype == FS_ISO9660)
+ sess = label.d_partitions[DISKPART(dev)].p_cdsession;
} else {
/* fallback to old method */
error = VOP_IOCTL(devvp, CDIOREADMSADDR, &sess, 0, FSCRED);
---
>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: kern/59783: Can't mount the "special" SGI volume formatted cd9660
Date: Sun, 23 Nov 2025 03:03:39 +0900
> >Synopsis: Can't mount the "special" SGI volume formatted cd9660
> boot -f scsi(0)cdrom(5)rdisk(0)partition(8)ip2xboot
>
> .. which means the SGI volume label is correct!
>
> But they can't be mounted.
This is because the CD-ROM image for sgimips includes
teh SGI volume header before ISO9660 (for its ARC BIOS)
and it has certain offset (more than 32KB for usual ISO9660).
In most case ISO9660 images don't include explicit disklabel
(i.e. raw struct cpu_disklabel) data in the disk image
and it should be handled by MD disklabel routines.
However most ports assume ISO9660 has no such offset.
> >Fix:
> from mlelstv on irc; I've tested this and it fixes it.
IIRC one annoying issue is sector size on ISO (usually 2048).
If we are trying to offset in actual disklabel, we have
to check carefully all values are consistent (in 512 bytes
or 2048 bytes etc).
Thanks,
---
Izumi Tsutsui
From: Adrian Chadd <adrian@freebsd.org>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/59783: Can't mount the "special" SGI volume formatted cd9660
Date: Sat, 22 Nov 2025 12:05:57 -0800
--000000000000f939c706443475d7
Content-Type: text/plain; charset="UTF-8"
On Sat, 22 Nov 2025 at 10:05, Izumi Tsutsui via gnats <
gnats-admin@netbsd.org> wrote:
>
> This is because the CD-ROM image for sgimips includes
> teh SGI volume header before ISO9660 (for its ARC BIOS)
> and it has certain offset (more than 32KB for usual ISO9660).
>
> In most case ISO9660 images don't include explicit disklabel
> (i.e. raw struct cpu_disklabel) data in the disk image
> and it should be handled by MD disklabel routines.
> However most ports assume ISO9660 has no such offset.
>
> > >Fix:
> > from mlelstv on irc; I've tested this and it fixes it.
>
> IIRC one annoying issue is sector size on ISO (usually 2048).
> If we are trying to offset in actual disklabel, we have
> to check carefully all values are consistent (in 512 bytes
> or 2048 bytes etc).
>
>
Yeah it's a bit of a minefield, that's for sure.
it's just that the installer can't mount its own CD-ROM image to install,
and i would like to fix that!
-adrian
> Thanks,
> ---
> Izumi Tsutsui
>
>
--000000000000f939c706443475d7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g=
mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, 22 Nov =
2025 at 10:05, Izumi Tsutsui via gnats <<a href=3D"mailto:gnats-admin@ne=
tbsd.org">gnats-admin@netbsd.org</a>> wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">
<br>
=C2=A0This is because the CD-ROM image for sgimips includes<br>
=C2=A0teh SGI volume header before ISO9660 (for its ARC BIOS)<br>
=C2=A0and it has certain offset (more than 32KB for usual ISO9660).<br>
<br>
=C2=A0In most case ISO9660 images don't include explicit disklabel<br>
=C2=A0(i.e. raw struct cpu_disklabel) data in the disk image<br>
=C2=A0and it should be handled by MD disklabel routines.<br>
=C2=A0However most ports assume ISO9660 has no such offset.<br>
<br>
=C2=A0> >Fix:<br>
=C2=A0> from mlelstv on irc; I've tested this and it fixes it.<br>
<br>
=C2=A0IIRC one annoying issue is sector size on ISO (usually 2048).<br>
=C2=A0If we are trying to offset in actual disklabel, we have<br>
=C2=A0to check carefully all values are consistent (in 512 bytes<br>
=C2=A0or 2048 bytes etc).<br>
<br></blockquote><div><br></div><div>Yeah it's a bit of a minefield, th=
at's for sure.</div><div><br></div><div>it's just that the installe=
r can't mount=C2=A0its own CD-ROM image to install, and i would like to=
fix that!</div><div><br></div><div><br></div><div><br></div><div>-adrian</=
div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
=C2=A0Thanks,<br>
=C2=A0---<br>
=C2=A0Izumi Tsutsui<br>
<br>
</blockquote></div></div>
--000000000000f939c706443475d7--
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: kern/59783: Can't mount the "special" SGI volume formatted cd9660
Date: Sun, 23 Nov 2025 06:41:08 +0900
> it's just that the installer can't mount its own CD-ROM image to install,
> and i would like to fix that!
Ah, I see, even on sgimips itself?
(Other ports cannot mount sgimips install CD)
IIRC it worked when I tried to sgimips installcd work on my O2
~20 years (!) ago. Maybe we should also check which change broke it?
https://github.com/NetBSD/src/commit/17b2c3c86e9d1362569e2595a1efd2d06ac181fa
---
Izumi Tsutsui
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/59783: Can't mount the "special" SGI volume formatted cd9660
Date: Sat, 22 Nov 2025 22:13:32 -0000 (UTC)
gnats-admin@NetBSD.org ("Izumi Tsutsui via gnats") writes:
> Ah, I see, even on sgimips itself?
> (Other ports cannot mount sgimips install CD)
The install CD is not an ISO image, but a hacked SGI volume. Other
ports don't support the SGI volume label, but you can create a
wedge manually at offset 2MB and then mount it.
On sgimips, the SGI volume label is translated into a fictitious
BSD label, which reports the ISO9660 partition as "4.2BSD" with
non-zero fsize/bsize/cpg parameters.
If you try to mount this with cd9660, it ignores the partition type
and interprets 'fsize' as a bad session offset. It probably works
with something like:
Index: sys/fs/cd9660/cd9660_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/cd9660/cd9660_vfsops.c,v
retrieving revision 1.105
diff -p -u -r1.105 cd9660_vfsops.c
--- sys/fs/cd9660/cd9660_vfsops.c 16 Feb 2025 18:38:58 -0000 1.105
+++ sys/fs/cd9660/cd9660_vfsops.c 22 Nov 2025 08:13:38 -0000
@@ -419,7 +419,8 @@ iso_mountfs(struct vnode *devvp, struct
error = VOP_IOCTL(devvp, DIOCGDINFO, &label, FREAD, FSCRED);
if (!error) {
/* XXX more sanity checks? */
- sess = label.d_partitions[DISKPART(dev)].p_cdsession;
+ if (label.d_partitions[DISKPART(dev)].p_fstype == FS_ISO9660)
+ sess = label.d_partitions[DISKPART(dev)].p_cdsession;
} else {
/* fallback to old method */
error = VOP_IOCTL(devvp, CDIOREADMSADDR, &sess, 0, FSCRED);
From: Adrian Chadd <adrian@freebsd.org>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/59783: Can't mount the "special" SGI volume formatted cd9660
Date: Mon, 24 Nov 2025 22:02:19 -0800
btw, the diff works fine for me, is there any reason not to land it?
From: "Michael van Elst" <mlelstv@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59783 CVS commit: src/sys/fs/cd9660
Date: Sat, 29 Nov 2025 21:45:57 +0000
Module Name: src
Committed By: mlelstv
Date: Sat Nov 29 21:45:57 UTC 2025
Modified Files:
src/sys/fs/cd9660: cd9660_vfsops.c
Log Message:
Interpret p_cdsession field in partition info only when the type
is set to FS_ISO9660. Other filesystem types use the field for p_fsize,
and default values there confuse the cd9660 filesystem code.
Fixes PR 59783.
To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/fs/cd9660/cd9660_vfsops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.