@@ -749,9 +749,37 @@ static void kvmi_handle_unsupported_event_action(struct kvm *kvm)
kvmi_sock_shutdown(KVMI(kvm));
}
+static int kvmi_vcpu_kill(int sig, struct kvm_vcpu *vcpu)
+{
+ struct kernel_siginfo siginfo[1] = {};
+ int err = -ESRCH;
+ struct pid *pid;
+
+ rcu_read_lock();
+ pid = rcu_dereference(vcpu->pid);
+ if (pid)
+ err = kill_pid_info(sig, siginfo, pid);
+ rcu_read_unlock();
+
+ return err;
+}
+
+static void kvmi_vm_shutdown(struct kvm *kvm)
+{
+ struct kvm_vcpu *vcpu;
+ int i;
+
+ kvm_for_each_vcpu(i, vcpu, kvm)
+ kvmi_vcpu_kill(SIGTERM, vcpu);
+}
+
void kvmi_handle_common_event_actions(struct kvm *kvm, u32 action)
{
switch (action) {
+ case KVMI_EVENT_ACTION_CRASH:
+ kvmi_vm_shutdown(kvm);
+ break;
+
default:
kvmi_handle_unsupported_event_action(kvm);
}