NetBSD-Bugs archive

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

kern/55985: BOOTSIG0 and BOOTSIG1 checks in FAT/msdosfs support prevent mounting Raspberry Pi Pico's USB mass storage



>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:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 10 14:30:00 +0000 2021
>Originator:     Ryo ONODERA
>Release:        NetBSD 9.99.80
>Organization:
Ryo ONODERA // ryo%tetera.org@localhost
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;

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index