lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20130201170656.75c0ce3c@redhat.com>
Date:	Fri, 1 Feb 2013 17:06:56 -0600
From:	Clark Williams <williams@...hat.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	RT <linux-rt-users@...r.kernel.org>
Subject: [PATCH] [PREEMPT_RT] make pagefault_{disable,enable}() back into
 static inlines

Thomas,

The PREEMPT_RT behavior of moving pagefault_disable() and
pagefault_enable() into mm/memory.c as EXPORT_SYMBOL_GPL symbols breaks
compilation of a third-party driver that builds fine on a stock kernel.
Yes, I know, I know, it's a binary driver, but my problem is that it
already compiles and works on a stock kernel; the compile breaks only
on a PREEMPT_RT kernel. The driver doesn't use the fault routines
directly but the symbols get pulled in due to references in
include/linux/io-memory.h.

One way to "fix" it would be to change the definitions to EXPORT_SYMBOL,
but what I wondered is if we should move them back into uaccess.h as
static inlines (like the upstream versions). I've done that in the
attached patch and it seems to work fine. What I'm not sure of are the
performance implications of calling migrate_{disable,enable} from a
static inline. 

Thoughts?

Signed-off-by: Clark Williams <williams@...hat.com>
---
 include/linux/uaccess.h | 25 +++++++++++++++++++++++--
 mm/memory.c             | 26 --------------------------
 2 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 44b3751..f2f6c08 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -4,6 +4,8 @@
 #include <linux/preempt.h>
 #include <asm/uaccess.h>
 
+#include <linux/sched.h>
+
 /*
  * These routines enable/disable the pagefault handler in that
  * it will not take any MM locks and go straight to the fixup table.
@@ -33,8 +35,27 @@ static inline void pagefault_enable(void)
 	raw_pagefault_enable();
 }
 #else
-extern void pagefault_disable(void);
-extern void pagefault_enable(void);
+static inline void pagefault_disable(void)
+{
+	migrate_disable();
+	current->pagefault_disabled++;
+	/*
+	 * make sure to have issued the store before a pagefault
+	 * can hit.
+	 */
+	barrier();
+}
+
+static inline void pagefault_enable(void)
+{
+	/*
+	 * make sure to issue those last loads/stores before enabling
+	 * the pagefault handler again.
+	 */
+	barrier();
+	current->pagefault_disabled--;
+	migrate_enable();
+}
 #endif
 
 #ifndef ARCH_HAS_NOCACHE_UACCESS
diff --git a/mm/memory.c b/mm/memory.c
index 66f0ca8..6140eb8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3484,32 +3484,6 @@ unlock:
 	return 0;
 }
 
-#ifdef CONFIG_PREEMPT_RT_FULL
-void pagefault_disable(void)
-{
-	migrate_disable();
-	current->pagefault_disabled++;
-	/*
-	 * make sure to have issued the store before a pagefault
-	 * can hit.
-	 */
-	barrier();
-}
-EXPORT_SYMBOL_GPL(pagefault_disable);
-
-void pagefault_enable(void)
-{
-	/*
-	 * make sure to issue those last loads/stores before enabling
-	 * the pagefault handler again.
-	 */
-	barrier();
-	current->pagefault_disabled--;
-	migrate_enable();
-}
-EXPORT_SYMBOL_GPL(pagefault_enable);
-#endif
-
 /*
  * By the time we get here, we already hold the mm semaphore
  */
-- 
1.7.11.7


Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ