KVM: arm64: BUG on failure to drop host privileges In pKVM mode we should never fail to drop host privileges but, if we do, we could be in an inconsistent state: 1. static key is flipped but we haven't completed initialisation 2. only a subset of CPUs may have dropped host privileges In this scenario, BUG is the only sensible action. Signed-off-by: Keir Fraser <keirf@google.com>
diff --git a/arch/arm64/kvm/pkvm.c b/arch/arm64/kvm/pkvm.c index 9b52ca9..d69f784 100644 --- a/arch/arm64/kvm/pkvm.c +++ b/arch/arm64/kvm/pkvm.c
@@ -334,10 +334,10 @@ static int __init finalize_pkvm(void) ret = pkvm_drop_host_privileges(); if (ret) { pr_err("Failed to finalize Hyp protection: %d\n", ret); - pkvm_firmware_rmem_clear(); + BUG(); } - return ret; + return 0; } device_initcall_sync(finalize_pkvm);