Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Mar 2017 16:53:22 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315420 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201703161653.v2GGrMHg038810@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



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