[BusyBox] nfsmount pointer bug

Sauder, Vernon Vernon.Sauder at spirentcom.com
Fri May 21 23:51:51 UTC 2004


Resubmitting:

Hello again.
I found a simple bug that should be fixed. If "mount -a" is done when 2 NFS
mounts are in fstab and they need to both have the "nolock" option (no local
portmap running), mount will do the second mount with the "lock" option and
timeout (take a very long time). This seems to be a pointer problem. A
pointer to strdup'd data is handed by pointer to nfsmount(). nfsmount() does
not use it as a dynamically allocated pointer; it sets it to point to a
static structure. This is OK until the next mount is retrieved from the
fstab and the options from that are parsed. In the parsing function, the
pointer is xrealloc'd which frees the internal static memory in nfsmount.
The next call to nfsmount would have undefined behavior. Here are 2 patches.
They is against the recent CVS version. One patch is simple: it makes a copy
of the pointer to pass to nfsmount and does not realloc it. The other patch
fixes nfsmount to not point to static data; it reallocs the pointer it is
handed and copies the data into it. There are probably other ways to fix
this but you can take your pick. (I have attached them so my emailer won't
mess up the formatting.) Please let me know if and when a patch for this is
applied to the archives; I would like to capture that snapshot locally and
finish testing with that.

What is the schedule for 1.0 release?

Vernon Sauder
www.spirentcom.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mount.patch
Type: application/octet-stream
Size: 1972 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20040521/b6cb014a/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nfsmount.patch
Type: application/octet-stream
Size: 2362 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20040521/b6cb014a/attachment-0001.obj 


More information about the busybox mailing list