svn commit: r315420 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Thu Mar 16 16:53:24 UTC 2017


Author: hselasky
Date: Thu Mar 16 16:53:22 2017
New Revision: 315420
URL: https://svnweb.freebsd.org/changeset/base/315420

Log:
  The LinuxKPI pagefault disable and enable functions can only be used
  pairwise to support the FreeBSD way of pushing and popping the page
  fault flags. Ensure this by requiring every occurrence of pagefault
  disable function call to have a corresponding pagefault enable call.
  
  Obtained from:		kmacy @
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/uaccess.h

Modified: head/sys/compat/linuxkpi/common/include/linux/uaccess.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/uaccess.h	Thu Mar 16 16:49:27 2017	(r315419)
+++ head/sys/compat/linuxkpi/common/include/linux/uaccess.h	Thu Mar 16 16:53:22 2017	(r315420)
@@ -67,22 +67,13 @@ extern int linux_copyout(const void *kad
 extern size_t linux_clear_user(void *uaddr, size_t len);
 extern int linux_access_ok(int rw, const void *uaddr, size_t len);
 
-/*
- * NOTE: The returned value from pagefault_disable() must be stored
- * and passed to pagefault_enable(). Else possible recursion on the
- * state can be lost.
- */
-static inline int __must_check
-pagefault_disable(void)
-{
-	return (vm_fault_disable_pagefaults());
-}
+#define	pagefault_disable(void) do {		\
+	int __saved_pflags =			\
+	    vm_fault_disable_pagefaults()
 
-static inline void
-pagefault_enable(int save)
-{
-	vm_fault_enable_pagefaults(save);
-}
+#define	pagefault_enable(void)				\
+	vm_fault_enable_pagefaults(__saved_pflags);	\
+} while (0)
 
 static inline bool
 pagefault_disabled(void)


More information about the svn-src-all mailing list