[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-bugs
Subject:    system/806: mount_msdos rejects valid filesystems
From:       mark () nfr ! net
Date:       1999-04-21 9:43:14
[Download RAW message or body]


>Number:         806
>Category:       system
>Synopsis:       mount_msdos rejects valid filesystems
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 21 09:40:01 MDT 1999
>Last-Modified:
>Originator:     Mark S
>Organization:
net
>Release:        
>Environment:
	
	System      : OpenBSD 2.4
	Architecture: OpenBSD.i386
	Machine     : i386
>Description:
	
When mounting a MSDOS filesystem, the kernel code tests for certain
values in the boot block.  Those values are not part of the filesystem,
but just happen to be present on bootable disks.  They are not
necessarily present on non-bootable disks.

If you try to mount a non-bootable disk, it refuses with EINVAL,
even though it is a valid DOS filesystem that other machines like
(e.g. regular DOS, Windows 95).

>How-To-Repeat:
	
Format a disk using mtools, then attempt to mount it.  I am using
Mtools version 2.0.5, dated 25 Aug 91.  

This is the first time that I've had problems with an mtools formatted
disk.  

I can send a sample dos file system image if it would help.

>Fix:
	

I created a patch that at least makes the problem go away.  I removed
the tests for magic bytes in the kernel code that does the mount.  I
verified that it now mounts non-bootable dos filesystems and that it
still refuses to mount some other non-dos disks (e.g. it won't mount
the openbsd boot disk).

I'm not sure what's going on in the second part of the patch
(where it says "if (pmp->pm_RootDirEnts == 0)").  It looks weird
to impose any conditions at all there, but I don't know the dos
filesystem well enough to be sure.

Here's the patch, if you want it.  (Notice in this patch that my RCS
version numbers do not match yours.)

Index: msdosfs_vfsops.c
===================================================================
RCS file: /home/master/openbsd_sys/msdosfs/msdosfs_vfsops.c,v
retrieving revision 1.1.1.1
diff -C5 -r1.1.1.1 msdosfs_vfsops.c
*** msdosfs_vfsops.c	1999/03/10 00:07:11	1.1.1.1
--- msdosfs_vfsops.c	1999/04/21 15:03:15
***************
*** 325,341 ****
  	bp->b_flags |= B_AGE;
  	bsp = (union bootsector *)bp->b_data;
  	b33 = (struct byte_bpb33 *)bsp->bs33.bsBPB;
  	b50 = (struct byte_bpb50 *)bsp->bs50.bsBPB;
  	b710 = (struct byte_bpb710 *)bsp->bs710.bsPBP;
- 	if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) {
- 	        if (bsp->bs50.bsBootSectSig0 != BOOTSIG0
- 		    || bsp->bs50.bsBootSectSig1 != BOOTSIG1) {
- 		        error = EINVAL;
- 			goto error_exit;
- 		}
- 	}
  
  	pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK);
  	bzero((caddr_t)pmp, sizeof *pmp);
  	pmp->pm_mountp = mp;
  
--- 325,334 ----
***************
*** 380,392 ****
  	        error = EINVAL;
  		goto error_exit;
  	}
  
  	if (pmp->pm_RootDirEnts == 0) {
!                 if (bsp->bs710.bsBootSectSig2 != BOOTSIG2
! 		    || bsp->bs710.bsBootSectSig3 != BOOTSIG3
! 		    || pmp->pm_Sectors
  		    || pmp->pm_FATsecs
  		    || getushort(b710->bpbFSVers)) {
  		        error = EINVAL;
  			goto error_exit;
  		}
--- 373,385 ----
  	        error = EINVAL;
  		goto error_exit;
  	}
  
  	if (pmp->pm_RootDirEnts == 0) {
!                 if (
! 		    
! 		    pmp->pm_Sectors
  		    || pmp->pm_FATsecs
  		    || getushort(b710->bpbFSVers)) {
  		        error = EINVAL;
  			goto error_exit;
  		}

>Audit-Trail:
>Unformatted:
no
kernel is too picky about format of msdos filesystems
non-critical
medium
sw-bug
openbsd 2.4

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic