Skip to content

Commit d972c8c

Browse files
jgross1gregkh
authored andcommitted
x86/mm: fix poking_init() for Xen PV guests
commit 26ce6ec upstream. Commit 3f4c821 ("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: 3f4c821 ("x86/mm: Use mm_alloc() in poking_init()") Signed-off-by: Juergen Gross <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7f3982d commit d972c8c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/mm/init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <asm/pti.h>
2828
#include <asm/text-patching.h>
2929
#include <asm/memtype.h>
30+
#include <asm/paravirt.h>
3031

3132
/*
3233
* We need to define the tracepoints somewhere, and tlb.c
@@ -829,6 +830,9 @@ void __init poking_init(void)
829830
poking_mm = copy_init_mm();
830831
BUG_ON(!poking_mm);
831832

833+
/* Xen PV guests need the PGD to be pinned. */
834+
paravirt_arch_dup_mmap(NULL, poking_mm);
835+
832836
/*
833837
* Randomize the poking address, but make sure that the following page
834838
* will be mapped at the same PMD. We need 2 pages, so find space for 3,

0 commit comments

Comments
 (0)