History

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.

Eric Hankland committed 7 years ago

Commit 66bb8a01 parent cdc238e7 files · +110 −0Browse files

Showing the changes to include/uapi/linux (1 of 7 files). Show all

Unified · Split

include/uapi/linux/kvm.h+3−0
@@ -995,6 +995,7 @@ struct kvm_ppc_resize_hpt { · 994 unmodified lines
995#define KVM_CAP_ARM_SVE 170995#define KVM_CAP_ARM_SVE 170
996#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171996#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
997#define KVM_CAP_ARM_PTRAUTH_GENERIC 172997#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
998#define KVM_CAP_PMU_EVENT_FILTER 173
998 999
999#ifdef KVM_CAP_IRQ_ROUTING1000#ifdef KVM_CAP_IRQ_ROUTING
1000 1001
@@ -1329,6 +1330,8 @@ struct kvm_s390_ucas_mapping { · 328 unmodified lines
1329#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)1330#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
1330/* Available with KVM_CAP_PPC_GET_CPU_CHAR */1331/* Available with KVM_CAP_PPC_GET_CPU_CHAR */
1331#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)1332#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)
1333/* Available with KVM_CAP_PMU_EVENT_FILTER */
1334#define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
1332 1335
1333/* ioctl for vm fd */1336/* ioctl for vm fd */
1334#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)1337#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)