* [PATCH] x86/kpti: WARN if kernel memory mapped to userspace is non-global
@ 2017-12-16 0:01 Dave Hansen
0 siblings, 0 replies; only message in thread
From: Dave Hansen @ 2017-12-16 0:01 UTC (permalink / raw)
To: linux-kernel
Cc: x86, Dave Hansen, tglx, luto, bp, brgerst, dvlasenk, hpa,
jpoimboe, torvalds, peterz, riel
From: Dave Hansen <dave.hansen@linux.intel.com>
All memory being mapped out to userspace is shared. That means that
it is both safe and _expected_ to have the page table Global bit set.
If a PMD is found without Global set, it either a place that could be
performing better, or something unexpected is being mapped out to
userspace. Both of those are things for which a warning is good.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
---
b/arch/x86/mm/kpti.c | 3 +++
1 file changed, 3 insertions(+)
diff -puN arch/x86/mm/kpti.c~kaiser-set-global-in-kernel-for-shared arch/x86/mm/kpti.c
--- a/arch/x86/mm/kpti.c~kaiser-set-global-in-kernel-for-shared 2017-12-15 09:47:52.884717268 -0800
+++ b/arch/x86/mm/kpti.c 2017-12-15 10:00:39.134715357 -0800
@@ -157,6 +157,9 @@ kpti_clone_pmds(unsigned long start, uns
if (WARN_ON(!target_pmd))
return;
+ /* Only clone PMDs which we *intend* to share: */
+ WARN_ON_ONCE(!(pmd_flags(*target_pmd) & _PAGE_GLOBAL));
+
/*
* Copy the PMD. That is, the kernelmode and usermode
* tables will share the last-level page tables of this
_
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-12-16 0:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-16 0:01 [PATCH] x86/kpti: WARN if kernel memory mapped to userspace is non-global Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome