]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
KVM: arm64: Ignore HCR_EL2.FIEN set by L1 guest's EL2
authorMarc Zyngier <maz@kernel.org>
Sun, 17 Aug 2025 20:21:55 +0000 (21:21 +0100)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 21 Aug 2025 23:28:46 +0000 (16:28 -0700)
An EL2 guest can set HCR_EL2.FIEN, which gives access to the RASv1p1
fault injection mechanism. This would allow an EL1 guest to inject
error records into the system, which does sound like a terrible idea.

Prevent this situation by added FIEN to the list of bits we silently
exclude from being inserted into the host configuration.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Link: https://lore.kernel.org/r/20250817202158.395078-4-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/hyp/vhe/switch.c

index e482181c66322a0acdab8dcfa91c55cce9851d8a..0998ad4a25524f673c6f513c7d721448847302c1 100644 (file)
@@ -43,8 +43,11 @@ DEFINE_PER_CPU(unsigned long, kvm_hyp_vector);
  *
  * - API/APK: they are already accounted for by vcpu_load(), and can
  *   only take effect across a load/put cycle (such as ERET)
+ *
+ * - FIEN: no way we let a guest have access to the RAS "Common Fault
+ *   Injection" thing, whatever that does
  */
-#define NV_HCR_GUEST_EXCLUDE   (HCR_TGE | HCR_API | HCR_APK)
+#define NV_HCR_GUEST_EXCLUDE   (HCR_TGE | HCR_API | HCR_APK | HCR_FIEN)
 
 static u64 __compute_hcr(struct kvm_vcpu *vcpu)
 {