Jeff Layton wrote: > On Fri, 06 Jul 2007 16:13:23 -0400 > Chuck Lever wrote: > >> I'm looking at nfs-utils/utils/mount in order to patch in support for >> passing a string of mount options to the kernel instead of an >> nfs_mount_data. >> >> In mount.c, main() invokes nfsmount() in nfsmount.c. nfsmount() defines >> a structure on the stack called "data", then returns a pointer to "data" >> which is then passed to the kernel by main(). >> >> I think the only way this continues to work is that there are three 1024 >> character buffers defined in nfsmount()'s stack frame before "data," >> which places "data" far enough up the stack that subsequent function >> calls in main() don't smash it. >> >> Although this doesn't cause bad behavior today, it needs to be fixed to >> prevent future changes from breaking things badly. >> > > In the git tree I'm looking at, "data" is declared static. Does that protect > it from getting smashed? Yes. For some reason, I missed that entirely the first time I looked at it. Notice that nfs4_mount_data is also declared static in nfs4mount.c.