• Jiří Paleček's avatar
    kvm: Nested KVM MMUs need PAE root too · 1cfff4d9
    Jiří Paleček authored
    On AMD processors, in PAE 32bit mode, nested KVM instances don't
    work. The L0 host get a kernel OOPS, which is related to
    arch.mmu->pae_root being NULL.
    
    The reason for this is that when setting up nested KVM instance,
    arch.mmu is set to &arch.guest_mmu (while normally, it would be
    &arch.root_mmu). However, the initialization and allocation of
    pae_root only creates it in root_mmu. KVM code (ie. in
    mmu_alloc_shadow_roots) then accesses arch.mmu->pae_root, which is the
    unallocated arch.guest_mmu->pae_root.
    
    This fix just allocates (and frees) pae_root in both guest_mmu and
    root_mmu (and also lm_root if it was allocated). The allocation is
    subject to previous restrictions ie. it won't allocate anything on
    64-bit and AFAIK not on Intel.
    
    Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=203923
    Fixes: 14c07ad8 ("x86/kvm/mmu: introduce guest_mmu")
    Signed-off-by: default avatarJiri Palecek <jpalecek@web.de>
    Tested-by: default avatarJiri Palecek <jpalecek@web.de>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    1cfff4d9
mmu.c 159 KB