Re: [PATCH 5.16 29/37] arm64: entry: Add vectors that have the bhb mitigation sequences

From: Pavel Machek
Date: Thu Mar 10 2022 - 18:27:40 EST


Hi!

> From: James Morse <james.morse@xxxxxxx>
>
> commit ba2689234be92024e5635d30fe744f4853ad97db upstream.
>
> Some CPUs affected by Spectre-BHB need a sequence of branches, or a
> firmware call to be run before any indirect branch. This needs to go
> in the vectors. No CPU needs both.
>
> While this can be patched in, it would run on all CPUs as there is a
> single set of vectors. If only one part of a big/little combination is
> affected, the unaffected CPUs have to run the mitigation too.

This adds build error. Same problem is in 5.10.

> --- /dev/null
> +++ b/arch/arm64/include/asm/vectors.h
> @@ -0,0 +1,34 @@
...
> +/*
> + * Note: the order of this enum corresponds to two arrays in entry.S:
> + * tramp_vecs and __bp_harden_el1_vectors. By default the canonical
> + * 'full fat' vectors are used directly.
> + */
> +enum arm64_bp_harden_el1_vectors {
> +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY
> + /*
> + * Perform the BHB loop mitigation, before branching to the canonical
> + * vectors.
> + */
> + EL1_VECTOR_BHB_LOOP,
> +
> + /*
> + * Make the SMC call for firmware mitigation, before branching to the
> + * canonical vectors.
> + */
> + EL1_VECTOR_BHB_FW,
> +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */
> +
> + /*
> + * Remap the kernel before branching to the canonical vectors.
> + */
> + EL1_VECTOR_KPTI,
> ++};
> +


Note "++". Following patch fixes this up, but it is still a trap for
people trying to bisect.

Best regards,
Pavel

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: Digital signature