NetBSD Problem Report #56801
From reinoud@gorilla.13thmonkey.org Sat Apr 23 15:26:56 2022
Return-Path: <reinoud@gorilla.13thmonkey.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))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 962B91A9239
for <gnats-bugs@gnats.NetBSD.org>; Sat, 23 Apr 2022 15:26:56 +0000 (UTC)
Message-Id: <20220423152647.DD33A2FF0942@gorilla.13thmonkey.org>
Date: Sat, 23 Apr 2022 17:26:47 +0200 (CEST)
From: reinoud@13thmonkey.org
Reply-To: reinoud@13thmonkey.org
To: gnats-bugs@NetBSD.org
Subject: mount_udf's mount structure is malformed on 64 bit kernel with 32 bit userland
X-Send-Pr-Version: 3.95
>Number: 56801
>Category: port-mips
>Synopsis: mount_udf's mount structure is malformed on 64 bit kernel with 32 bit userland
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-mips-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Apr 23 15:30:00 +0000 2022
>Closed-Date: Tue Apr 26 11:50:19 +0000 2022
>Last-Modified: Tue Apr 26 11:50:19 +0000 2022
>Originator: Reinoud Zandijk
>Release: NetBSD 9.99.96
>Organization:
NetBSD
>Environment:
System: NetBSD mipssim64.13thmonkey.org 9.99.96 NetBSD 9.99.96 (MIPSSIM64) #0: Sat Apr 23 16:53:36 CEST 2022 reinoud@gorilla.13thmonkey.org:/tmp/obj/sys/arch/evbmips/compile/MIPSSIM64 evbmips
Architecture: mips
Machine: evbmips
mipssim64# file /netbsd
/netbsd: ELF 64-bit MSB executable, MIPS, MIPS-III version 1 (SYSV), statically linked, for NetBSD 9.99.96, not stripped
mipssim64# file /sbin/mount_udf
/sbin/mount_udf: ELF 32-bit MSB pie executable, MIPS, N32 MIPS-III version 1 (SYSV), dynamically linked, interpreter /libexec/l
d.elf_so, for NetBSD 9.1, not stripped
mipssim64# ls -al /sbin/mount_udf
-r-xr-xr-x 1 root wheel 14200 Oct 18 2020 /sbin/mount_udf
>Description:
When trying to mount an file image on the machine (in Qemu) using vnd it
reports an error. Peeking in with kgdb, it seems that the mount structure is
reported too short. The kernel reports a size of 80 and the userland a size of
72.
When printed in the mount_udf.c, the mount structure is userland is correct.
In the kernel its received/interpreted as the following struct which is
definatively wrong:
(gdb) print *args
$9 = {version = 1, fspec = 0x0, sessionnr = 0, udfmflags = 32767, gmtoff = 39, anon_uid = 32767, anon_gid = 39,
nobody_uid = 0, nobody_gid = 0, sector_size = 0, reserved = '\000' <repeats 31 times>, "H"}
>How-To-Repeat:
Start a 64 bit kernel in Qemu with a 32 bit userland and try to mount a disc
with mount_udf. It fails due to different lengths (in udf_mount in
udf_vfsops.c:315).
>Fix:
Most likely the structure is not converted correctly or not converted at all.
>Release-Note:
>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-mips/56801: mount_udf's mount structure is malformed on 64
bit kernel with 32 bit userland
Date: Sat, 23 Apr 2022 17:56:36 +0200
On Sat, Apr 23, 2022 at 03:30:00PM +0000, reinoud@13thmonkey.org wrote:
> Most likely the structure is not converted correctly or not converted at all.
The FS specific part for UDF is missing, see
src/sys/compat/netbsd32/netbsd32_fs.c:netbsd32___mount50
You need to add code there.
Martin
From: "Reinoud Zandijk" <reinoud@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56801 CVS commit: src/sys/compat/netbsd32
Date: Sat, 23 Apr 2022 17:46:23 +0000
Module Name: src
Committed By: reinoud
Date: Sat Apr 23 17:46:23 UTC 2022
Modified Files:
src/sys/compat/netbsd32: netbsd32.h netbsd32_fs.c
Log Message:
Implement support for mounting UDF in compat32
Fixes PR#56801
To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.94 -r1.95 src/sys/compat/netbsd32/netbsd32_fs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56801 CVS commit: [netbsd-9] src/sys
Date: Sun, 24 Apr 2022 16:39:00 +0000
Module Name: src
Committed By: martin
Date: Sun Apr 24 16:39:00 UTC 2022
Modified Files:
src/sys/compat/netbsd32 [netbsd-9]: netbsd32.h netbsd32_fs.c
src/sys/fs/udf [netbsd-9]: udf_subr.c
Log Message:
Pull up following revision(s) (requested by reinoud in ticket #1438):
sys/compat/netbsd32/netbsd32.h: revision 1.140
sys/compat/netbsd32/netbsd32_fs.c: revision 1.95
sys/fs/udf/udf_subr.c: revision 1.169
Fix endian issue with UDF extended attribute handling
Implement support for mounting UDF in compat32
Fixes PR#56801
To generate a diff of this commit:
cvs rdiff -u -r1.123.4.1 -r1.123.4.2 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.82.4.1 -r1.82.4.2 src/sys/compat/netbsd32/netbsd32_fs.c
cvs rdiff -u -r1.146.2.2 -r1.146.2.3 src/sys/fs/udf/udf_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: reinoud@NetBSD.org
State-Changed-When: Tue, 26 Apr 2022 11:50:19 +0000
State-Changed-Why:
Fixed by commit
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.