svn commit: r356147 - head/sys/compat/linux

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Dec 28 13:35:54 UTC 2019


Author: trasz
Date: Sat Dec 28 13:35:54 2019
New Revision: 356147
URL: https://svnweb.freebsd.org/changeset/base/356147

Log:
  Make linux mount(2) tolerate NULL 'from' argument, and fix flag
  handling.
  
  This should unbreak access04, acct01, chmod06, creat06,
  and fchmod06 LTP tests.
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/compat/linux/linux_file.c

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Sat Dec 28 12:16:40 2019	(r356146)
+++ head/sys/compat/linux/linux_file.c	Sat Dec 28 13:35:54 2019	(r356147)
@@ -1016,9 +1016,13 @@ linux_mount(struct thread *td, struct linux_mount_args
 	    NULL);
 	if (error != 0)
 		goto out;
-	error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, NULL);
-	if (error != 0)
-		goto out;
+	if (args->specialfile != NULL) {
+		error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, NULL);
+		if (error != 0)
+			goto out;
+	} else {
+		mntfromname[0] = '\0';
+	}
 	error = copyinstr(args->dir, mntonname, MNAMELEN - 1, NULL);
 	if (error != 0)
 		goto out;
@@ -1033,20 +1037,18 @@ linux_mount(struct thread *td, struct linux_mount_args
 
 	fsflags = 0;
 
-	if ((args->rwflag & 0xffff0000) == 0xc0ed0000) {
-		/*
-		 * Linux SYNC flag is not included; the closest equivalent
-		 * FreeBSD has is !ASYNC, which is our default.
-		 */
-		if (args->rwflag & LINUX_MS_RDONLY)
-			fsflags |= MNT_RDONLY;
-		if (args->rwflag & LINUX_MS_NOSUID)
-			fsflags |= MNT_NOSUID;
-		if (args->rwflag & LINUX_MS_NOEXEC)
-			fsflags |= MNT_NOEXEC;
-		if (args->rwflag & LINUX_MS_REMOUNT)
-			fsflags |= MNT_UPDATE;
-	}
+	/*
+	 * Linux SYNC flag is not included; the closest equivalent
+	 * FreeBSD has is !ASYNC, which is our default.
+	 */
+	if (args->rwflag & LINUX_MS_RDONLY)
+		fsflags |= MNT_RDONLY;
+	if (args->rwflag & LINUX_MS_NOSUID)
+		fsflags |= MNT_NOSUID;
+	if (args->rwflag & LINUX_MS_NOEXEC)
+		fsflags |= MNT_NOEXEC;
+	if (args->rwflag & LINUX_MS_REMOUNT)
+		fsflags |= MNT_UPDATE;
 
 	error = kernel_vmount(fsflags,
 	    "fstype", fstypename,


More information about the svn-src-head mailing list