]> git.baikalelectronics.ru Git - kernel.git/commit
arm64/kvm: disable access to AMU registers from kvm guests
authorIonela Voinescu <ionela.voinescu@arm.com>
Thu, 5 Mar 2020 09:06:23 +0000 (09:06 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 6 Mar 2020 16:02:50 +0000 (16:02 +0000)
commit3a66b444ab16d8bf9725b231bb499ae2973b4c9e
treef5e42cdd03427f310935e3e1b3378f8263a9d969
parent3da2a181205ddd9faf14455b92a48505879d5ba5
arm64/kvm: disable access to AMU registers from kvm guests

Access to the AMU counters should be disabled by default in kvm guests,
as information from the counters might reveal activity in other guests
or activity on the host.

Therefore, disable access to AMU registers from EL0 and EL1 in kvm
guests by:
 - Hiding the presence of the extension in the feature register
   (SYS_ID_AA64PFR0_EL1) on the VCPU.
 - Disabling access to the AMU registers before switching to the guest.
 - Trapping accesses and injecting an undefined instruction into the
   guest.

Signed-off-by: Ionela Voinescu <ionela.voinescu@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Julien Thierry <julien.thierry.kdev@gmail.com>
Cc: James Morse <james.morse@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/kvm_arm.h
arch/arm64/kvm/hyp/switch.c
arch/arm64/kvm/sys_regs.c