diff options
author | Eric Hankland <ehankland@google.com> | 2019-07-10 18:25:15 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-11 15:08:28 +0200 |
commit | 66bb8a065f5aedd4551d8d3fbce582972f65c2e1 (patch) | |
tree | e91f4895073a3f406a02037637d8ac27ee5c4d9b /arch/x86/include/uapi/asm/kvm.h | |
parent | cdc238eb72f6b94b6c33b98c07b9fc3ac5e57b18 (diff) |
KVM: x86: PMU Event Filter
Some events can provide a guest with information about other guests or the
host (e.g. L3 cache stats); providing the capability to restrict access
to a "safe" set of events would limit the potential for the PMU to be used
in any side channel attacks. This change introduces a new VM ioctl that
sets an event filter. If the guest attempts to program a counter for
any blacklisted or non-whitelisted event, the kernel counter won't be
created, so any RDPMC/RDMSR will show 0 instances of that event.
Signed-off-by: Eric Hankland <ehankland@google.com>
[Lots of changes. All remaining bugs are probably mine. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include/uapi/asm/kvm.h')
-rw-r--r-- | arch/x86/include/uapi/asm/kvm.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h index f9b021e16ebc..46588f5d6283 100644 --- a/arch/x86/include/uapi/asm/kvm.h +++ b/arch/x86/include/uapi/asm/kvm.h @@ -422,4 +422,14 @@ struct kvm_nested_state { __u8 data[0]; }; +/* for KVM_CAP_PMU_EVENT_FILTER */ +struct kvm_pmu_event_filter { + __u32 action; + __u32 nevents; + __u64 events[0]; +}; + +#define KVM_PMU_EVENT_ALLOW 0 +#define KVM_PMU_EVENT_DENY 1 + #endif /* _ASM_X86_KVM_H */ |