Displaying 12 results from an estimated 12 matches for "kvmi_get_registers".
2020 Feb 07
0
[RFC PATCH v7 54/78] KVM: introspection: add KVMI_VCPU_GET_REGISTERS
...s_reply *rpl;
+ u16 k, n = req->nmsrs;
+
+ *rpl_size = struct_size(rpl, msrs.entries, n);
+ rpl = kvmi_msg_alloc_check(*rpl_size);
+ if (rpl) {
+ rpl->msrs.nmsrs = n;
+
+ for (k = 0; k < n; k++)
+ rpl->msrs.entries[k].index = req->msrs_idx[k];
+ }
+
+ return rpl;
+}
+
+static int kvmi_get_registers(struct kvm_vcpu *vcpu, u32 *mode,
+ struct kvm_regs *regs,
+ struct kvm_sregs *sregs,
+ struct kvm_msrs *msrs)
+{
+ struct kvm_msr_entry *msr = msrs->entries;
+ struct kvm_msr_entry *end = msrs->entries + msrs->nmsrs;
+ int err = 0;
+
+ kvm_arch_vcpu_get_regs(vcpu,...
2020 Jul 21
0
[PATCH v9 56/84] KVM: introspection: add KVMI_VCPU_GET_REGISTERS
...dr *msg,
+ const struct kvmi_vcpu_get_registers *req)
+{
+ size_t req_size;
+
+ if (check_add_overflow(sizeof(struct kvmi_vcpu_hdr),
+ struct_size(req, msrs_idx, req->nmsrs),
+ &req_size))
+ return -1;
+
+ if (msg->size < req_size)
+ return -1;
+
+ return 0;
+}
+
+static int kvmi_get_registers(struct kvm_vcpu *vcpu, u32 *mode,
+ struct kvm_regs *regs,
+ struct kvm_sregs *sregs,
+ struct kvm_msrs *msrs)
+{
+ struct kvm_msr_entry *msr = msrs->entries;
+ struct kvm_msr_entry *end = msrs->entries + msrs->nmsrs;
+ struct msr_data m = {.host_initiated = true};...
2019 Aug 09
0
[RFC PATCH v6 55/92] kvm: introspection: add KVMI_CONTROL_MSR and KVMI_EVENT_MSR
...ue;
+
+ ikvm = kvmi_get(vcpu->kvm);
+ if (!ikvm)
+ return true;
+
+ if (is_event_enabled(vcpu, KVMI_EVENT_MSR))
+ ret = __kvmi_msr_event(vcpu, msr);
+
+ kvmi_put(vcpu->kvm);
+
+ return ret;
+}
+
static void *alloc_get_registers_reply(const struct kvmi_msg_hdr *msg,
const struct kvmi_get_registers *req,
size_t *rpl_size)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index fc78b0052dee..cdb315578979 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -7098,6 +7098,20 @@ static int nested_enable_evmcs(struct kvm_vcpu *vcpu,
return -ENODEV;
}
+static void svm_msr...
2019 Aug 09
0
[RFC PATCH v6 06/92] kvm: introspection: add KVMI_CONTROL_CMD_RESPONSE
...KVMI_CONTROL_CMD_RESPONSE enable=0 now=1
+ KVMI_SET_REGISTERS vcpu=N
+ KVMI_EVENT_REPLY vcpu=N
+ KVMI_CONTROL_CMD_RESPONSE enable=1 now=0
+
+While the command reply is disabled:
+
+* the socket will be closed on any command for which the reply should
+ contain more than just an error code (eg. *KVMI_GET_REGISTERS*)
+
+* the reply status is ignored for any unsupported/unknown or disallowed
+ commands (and ``struct kvmi_error_code`` will be sent with -KVM_EOPNOTSUPP
+ or -KVM_PERM).
diff --git a/include/uapi/linux/kvmi.h b/include/uapi/linux/kvmi.h
index 9574ba0b9565..a1ab39c5b8e0 100644
--- a/include/uapi/...
2019 Aug 12
2
[RFC PATCH v6 01/92] kvm: introduce KVMI (VM introspection subsystem)
...INFO = 5,
> + KVMI_GET_VCPU_INFO = 6,
> + KVMI_PAUSE_VCPU = 7,
> + KVMI_CONTROL_VM_EVENTS = 8,
> + KVMI_CONTROL_EVENTS = 9,
> + KVMI_CONTROL_CR = 10,
> + KVMI_CONTROL_MSR = 11,
> + KVMI_CONTROL_VE = 12,
> + KVMI_GET_REGISTERS = 13,
> + KVMI_SET_REGISTERS = 14,
> + KVMI_GET_CPUID = 15,
> + KVMI_GET_XSAVE = 16,
> + KVMI_READ_PHYSICAL = 17,
> + KVMI_WRITE_PHYSICAL = 18,
> + KVMI_INJECT_EXCEPTION = 19,
> + KVMI_GET_PAGE_ACCESS = 20,
>...
2019 Aug 09
0
[RFC PATCH v6 04/92] kvm: introspection: add the read/dispatch message function
Based on the common header used by all messages (struct kvmi_msg_hdr),
the worker will read/validate all messages, execute the VM introspection
commands (eg. KVMI_GET_GUEST_INFO) and dispatch to vCPUs the vCPU
introspection commands (eg. KVMI_GET_REGISTERS) and the replies to
vCPU events. The vCPU threads will reply to vCPU introspection commands
without the help of the receiving worker.
Because of the command header (struct kvmi_error_code) used in any
command reply, this worker could respond to any unsupported/disallowed
command with an error code...
2019 Aug 09
0
[RFC PATCH v6 01/92] kvm: introduce KVMI (VM introspection subsystem)
...K_EVENT = 4,
+ KVMI_GET_GUEST_INFO = 5,
+ KVMI_GET_VCPU_INFO = 6,
+ KVMI_PAUSE_VCPU = 7,
+ KVMI_CONTROL_VM_EVENTS = 8,
+ KVMI_CONTROL_EVENTS = 9,
+ KVMI_CONTROL_CR = 10,
+ KVMI_CONTROL_MSR = 11,
+ KVMI_CONTROL_VE = 12,
+ KVMI_GET_REGISTERS = 13,
+ KVMI_SET_REGISTERS = 14,
+ KVMI_GET_CPUID = 15,
+ KVMI_GET_XSAVE = 16,
+ KVMI_READ_PHYSICAL = 17,
+ KVMI_WRITE_PHYSICAL = 18,
+ KVMI_INJECT_EXCEPTION = 19,
+ KVMI_GET_PAGE_ACCESS = 20,
+ KVMI_SET_PAGE_ACCESS = 21,
+ KVM...
2019 Aug 09
117
[RFC PATCH v6 00/92] VM introspection
...introspection: add KVMI_CONTROL_EVENTS
kvm: x86: add kvm_spt_fault()
kvm: introspection: add KVMI_EVENT_PF
kvm: introspection: add KVMI_GET_PAGE_ACCESS
kvm: introspection: add KVMI_SET_PAGE_ACCESS
kvm: introspection: add KVMI_READ_PHYSICAL and KVMI_WRITE_PHYSICAL
kvm: introspection: add KVMI_GET_REGISTERS
kvm: introspection: add KVMI_SET_REGISTERS
kvm: introspection: add KVMI_INJECT_EXCEPTION + KVMI_EVENT_TRAP
kvm: introspection: add KVMI_CONTROL_CR and KVMI_EVENT_CR
kvm: introspection: add KVMI_CONTROL_MSR and KVMI_EVENT_MSR
kvm: introspection: add KVMI_GET_XSAVE
kvm: introspection: add...
2019 Aug 09
117
[RFC PATCH v6 00/92] VM introspection
...introspection: add KVMI_CONTROL_EVENTS
kvm: x86: add kvm_spt_fault()
kvm: introspection: add KVMI_EVENT_PF
kvm: introspection: add KVMI_GET_PAGE_ACCESS
kvm: introspection: add KVMI_SET_PAGE_ACCESS
kvm: introspection: add KVMI_READ_PHYSICAL and KVMI_WRITE_PHYSICAL
kvm: introspection: add KVMI_GET_REGISTERS
kvm: introspection: add KVMI_SET_REGISTERS
kvm: introspection: add KVMI_INJECT_EXCEPTION + KVMI_EVENT_TRAP
kvm: introspection: add KVMI_CONTROL_CR and KVMI_EVENT_CR
kvm: introspection: add KVMI_CONTROL_MSR and KVMI_EVENT_MSR
kvm: introspection: add KVMI_GET_XSAVE
kvm: introspection: add...
2019 Aug 09
0
[RFC PATCH v6 16/92] kvm: introspection: handle events and event replies
...ction - x86
+ *
+ * Copyright (C) 2019 Bitdefender S.R.L.
+ */
+#include "x86.h"
+#include "../../../virt/kvm/kvmi_int.h"
+
+/*
+ * TODO: this can be done from userspace.
+ * - all these registers are sent with struct kvmi_event_arch
+ * - userspace can request MSR_EFER with KVMI_GET_REGISTERS
+ */
+static unsigned int kvmi_vcpu_mode(const struct kvm_vcpu *vcpu,
+ const struct kvm_sregs *sregs)
+{
+ unsigned int mode = 0;
+
+ if (is_long_mode((struct kvm_vcpu *) vcpu)) {
+ if (sregs->cs.l)
+ mode = 8;
+ else if (!sregs->cs.db)
+ mode = 2;
+ else
+ mode = 4;
+ } else...
2020 Feb 07
78
[RFC PATCH v7 00/78] VM introspection
The KVM introspection subsystem provides a facility for applications
running on the host or in a separate VM, to control the execution of
other VMs (pause, resume, shutdown), query the state of the vCPUs (GPRs,
MSRs etc.), alter the page access bits in the shadow page tables (only
for the hardware backed ones, eg. Intel's EPT) and receive notifications
when events of interest have taken place
2020 Jul 21
87
[PATCH v9 00/84] VM introspection
The KVM introspection subsystem provides a facility for applications
running on the host or in a separate VM, to control the execution of
other VMs (pause, resume, shutdown), query the state of the vCPUs (GPRs,
MSRs etc.), alter the page access bits in the shadow page tables (only
for the hardware backed ones, eg. Intel's EPT) and receive notifications
when events of interest have taken place