]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Avoid killing userspace through guest SRAO MCE on unmapped pages
authorHuang Ying <ying.huang@intel.com>
Mon, 31 May 2010 06:28:19 +0000 (14:28 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:35:26 +0000 (10:35 +0300)
commit7fa946d8c178a3949dfd37eacc1f6f6e7f0c8990
tree616c19474d7cb626ff9eebc54f6753563a4322cd
parent601898eceb11ee265766af1bf451f8026270421a
KVM: Avoid killing userspace through guest SRAO MCE on unmapped pages

In common cases, guest SRAO MCE will cause corresponding poisoned page
be un-mapped and SIGBUS be sent to QEMU-KVM, then QEMU-KVM will relay
the MCE to guest OS.

But it is reported that if the poisoned page is accessed in guest
after unmapping and before MCE is relayed to guest OS, userspace will
be killed.

The reason is as follows. Because poisoned page has been un-mapped,
guest access will cause guest exit and kvm_mmu_page_fault will be
called. kvm_mmu_page_fault can not get the poisoned page for fault
address, so kernel and user space MMIO processing is tried in turn. In
user MMIO processing, poisoned page is accessed again, then userspace
is killed by force_sig_info.

To fix the bug, kvm_mmu_page_fault send HWPOISON signal to QEMU-KVM
and do not try kernel and user space MMIO processing for poisoned
page.

[xiao: fix warning introduced by avi]

Reported-by: Max Asbock <masbock@linux.vnet.ibm.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c
arch/x86/kvm/paging_tmpl.h
include/linux/kvm_host.h
include/linux/mm.h
mm/memory-failure.c
virt/kvm/kvm_main.c