]> git.baikalelectronics.ru Git - kernel.git/commit
mm: thp: KVM: Explicitly check for THP when populating secondary MMU
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 8 Jan 2020 20:24:36 +0000 (12:24 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 27 Jan 2020 19:00:01 +0000 (20:00 +0100)
commitfed18bbe8d301fed8a914fc515bc3e71e79425de
tree0d0b3d133dfd012cfe53f548397308a7089da89c
parent85c9ebbc484857ee05dfdd7415ff97e5a7ef75a7
mm: thp: KVM: Explicitly check for THP when populating secondary MMU

Add a helper, is_transparent_hugepage(), to explicitly check whether a
compound page is a THP and use it when populating KVM's secondary MMU.
The explicit check fixes a bug where a remapped compound page, e.g. for
an XDP Rx socket, is mapped into a KVM guest and is mistaken for a THP,
which results in KVM incorrectly creating a huge page in its secondary
MMU.

Fixes: 676288a7dd991 ("thp: kvm mmu transparent hugepage support")
Reported-by: syzbot+c9d1fb51ac9d0d10c39d@syzkaller.appspotmail.com
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
include/linux/huge_mm.h
include/linux/kvm_host.h
mm/huge_memory.c
virt/kvm/arm/mmu.c
virt/kvm/kvm_main.c