BusyBox-1.3.0: mount -a crashes

Johannes Stezenbach js at sig21.net
Fri Dec 15 20:14:01 UTC 2006


Hi,

mount -a crashes with my fstab which contains an NFS mount.

The patch below seems to fix it for me. Here's a tracback
from gdb when it crashes:

Program terminated with signal 11, Segmentation fault.
#0  0x004b7e1c in free ()
(gdb) bt
#0  0x004b7e1c in free ()
#1  0x0048d8c4 in nfsmount (mp=0x7ff34c70, vfsflags=32768, filteropts=0x5330c0 "soft,intr,tcp,nolock")
    at util-linux/mount.c:839
#2  0x0048efa0 in singlemount (mp=0x7ff34c70, ignore_busy=1) at util-linux/mount.c:1427
#3  0x0048f9cc in mount_main (argc=0, argv=0x7ff34dfc) at util-linux/mount.c:1696
#4  0x0040094c in run_applet_by_name (name=0x7ff34ec1 "mount", argc=2, argv=0x7ff34df4)
    at applets/applets.c:481
#5  0x00400ba8 in main (argc=5353373, argv=0x5330c0) at applets/busybox.c:71
(gdb) f 1
#1  0x0048d8c4 in nfsmount (mp=0x7ff34c70, vfsflags=32768, filteropts=0x5330c0 "soft,intr,tcp,nolock")
    at util-linux/mount.c:839
839			free(mp->mnt_opts);
(gdb) p mp
$1 = (struct mntent *) 0x7ff34c70
(gdb) p *mp
$2 = {mnt_fsname = 0x51af78 "172.16.0.1:/nfsdir", mnt_dir = 0x51af90 "/mnt", mnt_type = 0x51af9d "nfs", 
  mnt_opts = 0x51afa5 "soft,intr,tcp,nolock", mnt_freq = 0, mnt_passno = 0}



--- busybox-1.3.0/util-linux/mount.c.orig	2006-12-15 20:31:48.000000000 +0100
+++ busybox-1.3.0/util-linux/mount.c	2006-12-15 20:32:58.000000000 +0100
@@ -1693,10 +1693,12 @@ int mount_main(int argc, char **argv)
 
 			// Mount this thing.
 
+			mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
 			if (singlemount(mtcur, 1)) {
 				/* Count number of failed mounts */
 				rc++;
 			}
+			free(mtcur->mnt_opts);
 		}
 	}
 	if (ENABLE_FEATURE_CLEAN_UP) endmntent(fstab);



More information about the busybox mailing list