summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2023-01-09 16:09:22 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-08 19:57:38 +0200
commitf076d081787803b972a9939e477c6456f0c8fd70 (patch)
treef5084e260de1ae08ace7e78d10140d2926cd3bcf
parent583016037a092e4189c86bad7946c6d88669b4ca (diff)
downloadlinux-f076d081787803b972a9939e477c6456f0c8fd70.tar.gz
linux-f076d081787803b972a9939e477c6456f0c8fd70.tar.bz2
linux-f076d081787803b972a9939e477c6456f0c8fd70.zip
x86/mm: fix poking_init() for Xen PV guests
commit 26ce6ec364f18d2915923bc05784084e54a5c4cc upstream. Commit 3f4c8211d982 ("x86/mm: Use mm_alloc() in poking_init()") broke the kernel for running as Xen PV guest. It seems as if the new address space is never activated before being used, resulting in Xen rejecting to accept the new CR3 value (the PGD isn't pinned). Fix that by adding the now missing call of paravirt_arch_dup_mmap() to poking_init(). That call was previously done by dup_mm()->dup_mmap() and it is a NOP for all cases but for Xen PV, where it is just doing the pinning of the PGD. Fixes: 3f4c8211d982 ("x86/mm: Use mm_alloc() in poking_init()") Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230109150922.10578-1-jgross@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/mm/init.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index ff3b0d8fe048..2234d1c3f412 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -27,6 +27,7 @@
#include <asm/pti.h>
#include <asm/text-patching.h>
#include <asm/memtype.h>
+#include <asm/paravirt.h>
/*
* We need to define the tracepoints somewhere, and tlb.c
@@ -807,6 +808,9 @@ void __init poking_init(void)
poking_mm = copy_init_mm();
BUG_ON(!poking_mm);
+ /* Xen PV guests need the PGD to be pinned. */
+ paravirt_arch_dup_mmap(NULL, poking_mm);
+
/*
* Randomize the poking address, but make sure that the following page
* will be mapped at the same PMD. We need 2 pages, so find space for 3,