Subject: Re: [PATCH] KVM: arm64: Inject UNDEF when host is executing an smc with imm16 != 0

From: Marc Zyngier <[email-masked]>
Date: Tue, 24 Mar 2026 14:43:27 +0000

On Tue, 24 Mar 2026 13:57:28 +0000,
Sebastian Ene <[email-masked]> wrote:
> 
> The ARM Service Calling Convention (SMCCC) specifies that the function
> identifier and parameters should be passed in registers, leaving the
> 16-bit immediate field of the SMC instruction un-handled.
> Currently, our pKVM handler ignores the immediate value, which could lead
> to non-compliant software relying on implementation-defined behavior.
> Enforce the host kernel running under pKVM to use an immediate value
> of 0 by decoding the ISS from the ESR_EL2 and inject an undefined
> instruction exception back to the caller.

No, that's completely wrong. SMC never UNDEFs, unless EL3 isn't
implemented. You can't just decide to generate an UNDEF because you
don't like the immediate.

All you are allowed to do is to return an error code.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.