From 0ec2539fbc12946b4a6a4c693f819c4ec9daf3b2 Mon Sep 17 00:00:00 2001 From: Vincent Donnefort Date: Thu, 6 Apr 2023 10:50:50 +0100 Subject: [PATCH] ANDROID: KVM: arm64: Prevent pKVM module loading after IOMMU init As a fail-safe mechanism, disable pKVM module loading after the IOMMU init is complete. This intends to make sure nothing can be loaded after the IOMMU driver is ready, in case a vendor would forget to call __pkvm_close_module_registration Bug: 254835242 Change-Id: I32a9752e145a8ef9787dae6319e37ba38544739b Signed-off-by: Vincent Donnefort --- arch/arm64/kvm/hyp/nvhe/iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/iommu.c b/arch/arm64/kvm/hyp/nvhe/iommu.c index f9431dca570e..6c90b32491f0 100644 --- a/arch/arm64/kvm/hyp/nvhe/iommu.c +++ b/arch/arm64/kvm/hyp/nvhe/iommu.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #define DRV_ID(drv_addr) ((unsigned long)drv_addr) @@ -469,6 +470,8 @@ int __pkvm_iommu_finalize(int err) if (!ret && err) pkvm_handle_system_misconfiguration(NO_DMA_ISOLATION); + __pkvm_close_late_module_registration(); + return ret; }