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

From: Greg Kroah-Hartman
Date: Fri Mar 11 2022 - 03:39:16 EST


On Fri, Mar 11, 2022 at 09:15:32AM +0100, Greg Kroah-Hartman wrote:
> On Fri, Mar 11, 2022 at 12:27:29AM +0100, Pavel Machek wrote:
> > 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.
>
> Ick, ok, will try to fix up, thanks for finding this.

Now fixed up for 5.16.y, 5.15.y, and 5.10.y, thanks.

greg k-h