Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Nov 2019 15:51:45 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354447 - head/sys/compat/linux
Message-ID:  <201911071551.xA7FpjML077824@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu Nov  7 15:51:44 2019
New Revision: 354447
URL: https://svnweb.freebsd.org/changeset/base/354447

Log:
  linux_renameat2: improve flag checks
  
  In the cases where Linux returns an error (e.g. passing in an undefined
  flag) there's no need for us to emit a message.  (The target of this
  message is a developer working on the linuxulatorm, not the author of
  presumably broken Linux software).
  
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21606

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

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Thu Nov  7 15:48:46 2019	(r354446)
+++ head/sys/compat/linux/linux_file.c	Thu Nov  7 15:51:44 2019	(r354447)
@@ -704,6 +704,13 @@ linux_renameat2(struct thread *td, struct linux_rename
 	int error, olddfd, newdfd;
 
 	if (args->flags != 0) {
+		if (args->flags & ~(LINUX_RENAME_EXCHANGE |
+		    LINUX_RENAME_NOREPLACE | LINUX_RENAME_WHITEOUT))
+			return (EINVAL);
+		if (args->flags & LINUX_RENAME_EXCHANGE &&
+		    args->flags & (LINUX_RENAME_NOREPLACE |
+		    LINUX_RENAME_WHITEOUT))
+			return (EINVAL);
 		linux_msg(td, "renameat2 unsupported flags 0x%x",
 		    args->flags);
 		return (EINVAL);

Modified: head/sys/compat/linux/linux_file.h
==============================================================================
--- head/sys/compat/linux/linux_file.h	Thu Nov  7 15:48:46 2019	(r354446)
+++ head/sys/compat/linux/linux_file.h	Thu Nov  7 15:51:44 2019	(r354447)
@@ -127,4 +127,11 @@
 #define	LINUX_F_UNLCK		2
 #endif
 
+/*
+ * renameat2 flags
+ */
+#define	LINUX_RENAME_NOREPLACE	0x00000001
+#define	LINUX_RENAME_EXCHANGE	0x00000002
+#define	LINUX_RENAME_WHITEOUT	0x00000004
+
 #endif	/* !_LINUX_FILE_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911071551.xA7FpjML077824>