Subject: Re: kern/29898: mount(2) can corrupt filesystem
To: None <gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 04/06/2005 09:32:07
On Apr 6,  4:30am, yamt@mwd.biglobe.ne.jp (yamt@mwd.biglobe.ne.jp) wrote:
-- Subject: kern/29898: mount(2) can corrupt filesystem

| 	restructure mount related code so that the caller of
| 	VFS_MOUNT doesn't need to alter mnt_flag/iflag.
| 	maybe by adding more arguments to VFS_MOUNT to describe the operation.

Isn't is as simple as doing:

Index: vfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.217
diff -u -u -r1.217 vfs_syscalls.c
--- vfs_syscalls.c	26 Feb 2005 21:34:56 -0000	1.217
+++ vfs_syscalls.c	6 Apr 2005 13:30:55 -0000
@@ -216,7 +216,11 @@
 			vput(vp);
 			return (EPERM);
 		}
-		goto update;
+		if (SCARGS(uap, flags) & MNT_GETARGS)
+			goto getargs;
+		else
+			goto update;
+
 	} else {
 		if (securelevel >= 2) {
 			vput(vp);
@@ -328,6 +332,7 @@
 	    MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP |
 	    MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
 	    MNT_IGNORE);
+ getargs:
 	/*
 	 * Mount the filesystem.
 	 */