Re: [PATCH v15 26/37] KVM: arm64: WARN on injected undef exceptions

Marc Zyngier <[email protected]>
Newsgroups dev.linux.lists.linux-coco,dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, 15 Jul 2026 15:28:28 +0100,
Steven Price <[email protected]> wrote:
> 
> The RMM doesn't allow injection of a undefined exception into a realm
> guest. Add a WARN to catch if this ever happens.
> 
> Signed-off-by: Steven Price <[email protected]>
> Reviewed-by: Gavin Shan <[email protected]>
> Reviewed-by: Suzuki K Poulose <[email protected]>
> ---
> Changes since v6:
>  * if (x) WARN(1, ...) makes no sense, just WARN(x, ...)!
> ---
>  arch/arm64/kvm/inject_fault.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
> index 6492397b73d7..613f223bc7a3 100644
> --- a/arch/arm64/kvm/inject_fault.c
> +++ b/arch/arm64/kvm/inject_fault.c
> @@ -327,6 +327,7 @@ void kvm_inject_size_fault(struct kvm_vcpu *vcpu)
>   */
>  void kvm_inject_undefined(struct kvm_vcpu *vcpu)
>  {
> +	WARN(vcpu_is_rec(vcpu), "Unexpected undefined exception injection to REC");
>  	if (vcpu_el1_is_32bit(vcpu))
>  		inject_undef32(vcpu);
>  	else

No. WARN_ONCE at a push, but even then, this looks dodgy.

Exceptions must be injectable. Otherwise, how do you respond to, for
example, a sysreg access for a feature that is hidden from the guest?

Will the RMM perform this in KVM's stead?

	M.

-- 
Jazz isn't dead. It just smells funny.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.