NetBSD Problem Report #55985
From ryo@tetera.org Wed Feb 10 14:28:02 2021
Return-Path: <ryo@tetera.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 BE0B41A9217
for <gnats-bugs@gnats.NetBSD.org>; Wed, 10 Feb 2021 14:28:02 +0000 (UTC)
Message-Id: <6023ed6f.1c69fb81.814a.52ba@mx.google.com>
Date: Wed, 10 Feb 2021 23:27:58 +0900
From: ryo@tetera.org
Reply-To: ryo@tetera.org
To: gnats-bugs@NetBSD.org
Subject: BOOTSIG0 and BOOTSIG1 checks in FAT/msdosfs support prevent mounting Raspberry Pi Pico's USB mass storage
X-Send-Pr-Version: 3.95
>Number: 55985
>Category: kern
>Synopsis: BOOTSIG0 and BOOTSIG1 checks in FAT/msdosfs support prevent mounting Raspberry Pi Pico's USB mass storage
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: ryoon
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 10 14:30:00 +0000 2021
>Closed-Date: Sat Feb 13 00:52:23 +0000 2021
>Last-Modified: Sat Feb 13 00:52:23 +0000 2021
>Originator: Ryo ONODERA
>Release: NetBSD 9.99.80
>Organization:
Ryo ONODERA // ryo@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
>Environment:
System: NetBSD brownie 9.99.80 NetBSD 9.99.80 (DTRACE7) #0: Wed Feb 10 22:52:23 JST 2021 ryoon@brownie:/usr/world/9.99/amd64/obj/sys/arch/amd64/compile/DTRACE7 amd64
Architecture: x86_64
Machine: amd64
>Description:
Raspberry Pi Pico acts as USB mass storage for writing a program to flash
memory.
Connect Raspberry Pi Pico to NetBSD/amd64 9.99.80 and run
# mount_msdos /dev/sd0e /mnt
and I have gotten EINVAL.
EINVAL is set in BOOTSIG0 and BOOTSIG1 check.
It seems that the check is not required to mount FAT/msdosfs partition.
FreeBSD disables the check in 2000.
https://cgit.freebsd.org/src/commit/sys/fs/msdosfs/msdosfs_vfsops.c?id=01f6cfbae09d900359166effc766dbfb943ac44f
OpenBSD removed the check in 1999.
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/msdosfs/msdosfs_vfsops.c.diff?r1=1.16&r2=1.17
Without the check, it seems that read and write have no problem.
>How-To-Repeat:
Connect Raspberry Pi Pico with USB microB cable.
Run "mount_msdos /dev/sd0e /mnt".
>Fix:
Index: sys/fs/msdosfs/msdosfs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/msdosfs/msdosfs_vfsops.c,v
retrieving revision 1.135
diff -u -r1.135 msdosfs_vfsops.c
--- sys/fs/msdosfs/msdosfs_vfsops.c 13 Apr 2020 19:23:17 -0000 1.135
+++ sys/fs/msdosfs/msdosfs_vfsops.c 10 Feb 2021 14:26:47 -0000
@@ -520,6 +520,7 @@
b50 = (struct byte_bpb50 *)bsp->bs50.bsBPB;
b710 = (struct byte_bpb710 *)bsp->bs710.bsBPB;
+#if 0
if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) {
if (bsp->bs50.bsBootSectSig0 != BOOTSIG0
|| bsp->bs50.bsBootSectSig1 != BOOTSIG1) {
@@ -530,6 +531,7 @@
goto error_exit;
}
}
+#endif
pmp = malloc(sizeof(*pmp), M_MSDOSFSMNT, M_WAITOK|M_ZERO);
pmp->pm_mountp = mp;
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->ryoon
Responsible-Changed-By: ryoon@NetBSD.org
Responsible-Changed-When: Wed, 10 Feb 2021 15:37:06 +0000
Responsible-Changed-Why:
I will take this.
From: "Ryo ONODERA" <ryoon@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55985 CVS commit: src/sys/fs/msdosfs
Date: Thu, 11 Feb 2021 00:15:55 +0000
Module Name: src
Committed By: ryoon
Date: Thu Feb 11 00:15:55 UTC 2021
Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c
Log Message:
Enable to mount Raspberry Pi Pico's USB mass storage partition
Fix PR kern/55985.
O.k. by thorpej@.
Pull-up to netbsd-8 and netbsd-9.
To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/fs/msdosfs/msdosfs_vfsops.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->pending-pullups
State-Changed-By: ryoon@NetBSD.org
State-Changed-When: Thu, 11 Feb 2021 00:23:59 +0000
State-Changed-Why:
Request pull-ups to netbsd-8 and netbsd-9
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55985 CVS commit: [netbsd-9] src/sys/fs/msdosfs
Date: Thu, 11 Feb 2021 12:58:29 +0000
Module Name: src
Committed By: martin
Date: Thu Feb 11 12:58:29 UTC 2021
Modified Files:
src/sys/fs/msdosfs [netbsd-9]: msdosfs_vfsops.c
Log Message:
Pull up following revision(s) (requested by ryoon in ticket #1204):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.136
Enable to mount Raspberry Pi Pico's USB mass storage partition
Fix PR kern/55985.
O.k. by thorpej@.
Pull-up to netbsd-8 and netbsd-9.
To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.130.4.1 src/sys/fs/msdosfs/msdosfs_vfsops.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/55985 CVS commit: [netbsd-8] src/sys/fs/msdosfs
Date: Thu, 11 Feb 2021 12:59:38 +0000
Module Name: src
Committed By: martin
Date: Thu Feb 11 12:59:38 UTC 2021
Modified Files:
src/sys/fs/msdosfs [netbsd-8]: msdosfs_vfsops.c
Log Message:
Pull up following revision(s) (requested by ryoon in ticket #1653):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.136
Enable to mount Raspberry Pi Pico's USB mass storage partition
Fix PR kern/55985.
O.k. by thorpej@.
Pull-up to netbsd-8 and netbsd-9.
To generate a diff of this commit:
cvs rdiff -u -r1.127.4.2 -r1.127.4.3 src/sys/fs/msdosfs/msdosfs_vfsops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: ryoon@NetBSD.org
State-Changed-When: Sat, 13 Feb 2021 00:52:23 +0000
State-Changed-Why:
Fixed.
>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.