[PATCH v8 0/9] CFI for ARM32 using LLVM

Linus Walleij linus.walleij at linaro.org
Tue Apr 30 00:43:06 PDT 2024


On Mon, Apr 29, 2024 at 4:54 PM Ard Biesheuvel <ardb at kernel.org> wrote:
> On Mon, 29 Apr 2024 at 15:22, Russell King (Oracle)
> <linux at armlinux.org.uk> wrote:
> >
> > I've applied this to a separate branch, and it should be in
> > linux-next by tomorrow.

Neat, it's nice to have some baseline for this.

> > Can we make these branches conditional on the use of CFI?
> >
> > Didn't Ard mention there was a way to do this using symbol aliases?
>
> Yes, but only if the prototypes are identical. Not sure why Linus
> decided to keep this separate, but 9386/2 implements this for
> flush_user_cache_all() vs. flush_kern_cache_all().

Yes I did it separately for bisectability.

> we could emit the branch instructions only when CFI is
> enabled (as in that case, SYM_TYPED_FUNC_START() expands to something
> that prevents a fall through)
>
> E.g.,
>
> --- a/arch/arm/mm/cache-v4wt.S
> +++ b/arch/arm/mm/cache-v4wt.S
> @@ -108,7 +108,9 @@ SYM_FUNC_END(v4wt_flush_user_cache_range)
>   *     - end    - virtual end address
>   */
>  SYM_TYPED_FUNC_START(v4wt_coherent_kern_range)
> +#ifdef CONFIG_CFI_CLANG
>         b       v4wt_coherent_user_range
> +#endif
>  SYM_FUNC_END(v4wt_coherent_kern_range)

Oh it's a bit ifdeffy but I'll make a patch like this because I
can't think of anything better.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list