[PATCH] ARM: Use conditionals for CFI branches

Ard Biesheuvel ardb at kernel.org
Tue Apr 30 06:45:53 PDT 2024


On Tue, 30 Apr 2024 at 13:45, Linus Walleij <linus.walleij at linaro.org> wrote:
>
> On Tue, Apr 30, 2024 at 11:19 AM Ard Biesheuvel <ardb at kernel.org> wrote:
>
>
> > These functions are only called indirectly if MULTI_CACHE is enabled,
> > right? If so, this could be
> >
> > #if defined(CONFIG_CFI_CLANG) && defined(MULTI_CACHE)
>
> Hm Sami may know better here, but with !MULTI_CACHE the
> functions are indeed called directly, but does that mean the
> compiler will not emit some magic bytes in front of these
> symbols then?
>

Ah yes, of course. So that wouldn't work.

So the alternative might be

#if defined(CONFIG_CFI_CLANG) && defined(MULTI_CACHE)
SYM_TYPED_FUNC_START(v4_flush_kern_dcache_area)
        b       v4_dma_flush_range
SYM_FUNC_END(v4_flush_kern_dcache_area)
#else
SYM_FUNC_ALIAS(v4_flush_kern_dcache_area, v4_dma_flush_range)
#endif

Of course, unless anyone has an interest in building these older
platforms with Clang and CFI, it doesn't really make a difference, so
perhaps we should just go with your version.



More information about the linux-arm-kernel mailing list