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
995995 #define KVM_CAP_ARM_SVE 170
996996 #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
997997 #define KVM_CAP_ARM_PTRAUTH_GENERIC 172
998+#define KVM_CAP_PMU_EVENT_FILTER 173
998999
9991000 #ifdef KVM_CAP_IRQ_ROUTING
10001001
@@ -1329,6 +1330,8 @@ struct kvm_s390_ucas_mapping { · 328 unmodified lines
13291330 #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
13301331 /* Available with KVM_CAP_PPC_GET_CPU_CHAR */
13311332 #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)
13321335
13331336 /* ioctl for vm fd */
13341337 #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)