[PATCH 05/10] KVM: arm64: nVHE: Add EL2 sync exception handler

Marc Zyngier maz at kernel.org
Sun Mar 17 04:42:44 PDT 2024


On Thu, 14 Mar 2024 20:24:31 +0000,
Pierre-Clément Tosi <ptosi at google.com> wrote:
> 
> Introduce handlers for EL2{t,h} synchronous exceptions distinct from
> handlers for other "invalid" exceptions when running with the nVHE host
> vector. This will allow a future patch to handle CFI (synchronous)
> errors without affecting other classes of exceptions.
> 
> Remove superfluous SP overflow check from the non-synchronous
> handlers.

Why are they superfluous? Because we are panic'ing? Detecting a stack
overflow is pretty valuable in any circumstances.

> 
> Signed-off-by: Pierre-Clément Tosi <ptosi at google.com>
> ---
>  arch/arm64/kvm/hyp/nvhe/host.S | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S
> index 27c989c4976d..1b9111c2b480 100644
> --- a/arch/arm64/kvm/hyp/nvhe/host.S
> +++ b/arch/arm64/kvm/hyp/nvhe/host.S
> @@ -183,7 +183,7 @@ SYM_FUNC_END(__host_hvc)
>  .endif
>  .endm
>  
> -.macro invalid_host_el2_vect
> +.macro host_el2_sync_vect
>  	.align 7
>  
>  	/*
> @@ -221,6 +221,11 @@ SYM_FUNC_END(__host_hvc)
>  	b	__hyp_do_panic
>  .endm
>  
> +.macro invalid_host_el2_vect
> +	.align 7
> +	b	__hyp_panic
> +.endm
> +
>  /*
>   * The host vector does not use an ESB instruction in order to avoid consuming
>   * SErrors that should only be consumed by the host. Guest entry is deferred by
> @@ -233,12 +238,12 @@ SYM_FUNC_END(__host_hvc)
>   */
>  	.align 11
>  SYM_CODE_START(__kvm_hyp_host_vector)
> -	invalid_host_el2_vect			// Synchronous EL2t
> +	host_el2_sync_vect			// Synchronous EL2t

The real question is: under which circumstances would running with
SP_EL0 be valid? I cannot see good reason for it.

	M.

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



More information about the linux-arm-kernel mailing list