4.2bsd `mount' syscall bug (and fix)
der Mouse
mouse at mcgill-vision.UUCP
Wed Nov 27 19:30:01 AEST 1985
The 4.2bsd mount() syscall appears to have a bug in it.
Symptom:
After certain attempts to perform an invalid mount, the system will
hang and must be forcibly crashed and rebooted.
Repeat-by:
mkdir foo
/etc/mount /dev/null foo
("Block device required" error message)
Now the next attempt to access /dev/null will hang the process
attempting to do so. For something like /dev/null, this will hang most
of the system.
Problem:
In sys/ufs_mount.c, when getmdev() detects certain errors, it will
return without unlocking the inode in question.
Fix:
Apply the following context diffs to sys/ufs_mount.c. Remember,
line number figures are for comparison only. Your line numbers may vary
depending on your coding style and degree of kernel hacking. Highway
mileage will likely be lower.
*** ufs_mount.c Wed Nov 27 04:21:53 1985
--- ufs_mount.c= Wed Nov 6 01:20:57 1985
***************
*** 266,272
if (ip == NULL)
return (u.u_error);
if ((ip->i_mode&IFMT) != IFBLK)
! { iput(ip); return(ENOTBLK); }
dev = (dev_t)ip->i_rdev;
if (major(dev) >= nblkdev)
{ iput(ip); return(ENXIO); }
--- 266,272 -----
if (ip == NULL)
return (u.u_error);
if ((ip->i_mode&IFMT) != IFBLK)
! return (ENOTBLK);
dev = (dev_t)ip->i_rdev;
if (major(dev) >= nblkdev)
return (ENXIO);
***************
*** 269,275
{ iput(ip); return(ENOTBLK); }
dev = (dev_t)ip->i_rdev;
if (major(dev) >= nblkdev)
! { iput(ip); return(ENXIO); }
iput(ip);
*pdev = dev;
return (0);
--- 269,275 -----
return (ENOTBLK);
dev = (dev_t)ip->i_rdev;
if (major(dev) >= nblkdev)
! return (ENXIO);
iput(ip);
*pdev = dev;
return (0);
--
der Mouse
USA: {ihnp4,decvax,akgua,etc}!utcsri!mcgill-vision!mouse
philabs!micomvax!musocs!mcgill-vision!mouse
Europe: mcvax!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse
Hacker: One responsible for destroying /
Wizard: One responsible for recovering it afterward
More information about the Comp.unix.wizards
mailing list