提交 3548bab5 编写于 作者: A Avi Kivity

KVM: Drop user return notifier when disabling virtualization on a cpu

This way, we don't leave a dangling notifier on cpu hotunplug or module
unload.  In particular, module unload leaves the notifier pointing into
freed memory.
Signed-off-by: NAvi Kivity <avi@redhat.com>
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
上级 046d8710
...@@ -201,6 +201,14 @@ void kvm_set_shared_msr(unsigned slot, u64 value) ...@@ -201,6 +201,14 @@ void kvm_set_shared_msr(unsigned slot, u64 value)
} }
EXPORT_SYMBOL_GPL(kvm_set_shared_msr); EXPORT_SYMBOL_GPL(kvm_set_shared_msr);
static void drop_user_return_notifiers(void *ignore)
{
struct kvm_shared_msrs *smsr = &__get_cpu_var(shared_msrs);
if (smsr->registered)
kvm_on_user_return(&smsr->urn);
}
unsigned long segment_base(u16 selector) unsigned long segment_base(u16 selector)
{ {
struct descriptor_table gdt; struct descriptor_table gdt;
...@@ -5004,6 +5012,7 @@ int kvm_arch_hardware_enable(void *garbage) ...@@ -5004,6 +5012,7 @@ int kvm_arch_hardware_enable(void *garbage)
void kvm_arch_hardware_disable(void *garbage) void kvm_arch_hardware_disable(void *garbage)
{ {
kvm_x86_ops->hardware_disable(garbage); kvm_x86_ops->hardware_disable(garbage);
drop_user_return_notifiers(garbage);
} }
int kvm_arch_hardware_setup(void) int kvm_arch_hardware_setup(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册