Re: [PATCH] init: verify that function is initcall_t at compile-time

From: Kees Cook
Date: Fri May 21 2021 - 14:00:34 EST


On Fri, 21 May 2021 09:26:10 +0200, Marco Elver wrote:
> In the spirit of making it hard to misuse an interface, add a
> compile-time assertion in the CONFIG_HAVE_ARCH_PREL32_RELOCATIONS case
> to verify the initcall function matches initcall_t, because the inline
> asm bypasses any type-checking the compiler would otherwise do. This
> will help developers catch incorrect API use in all configurations.
>
> A recent example of this is:
> https://lkml.kernel.org/r/20210514140015.2944744-1-arnd@xxxxxxxxxx

Since this touches on CFI, I've taken this patch.

Applied to for-next/clang/features, thanks!

[1/1] init: verify that function is initcall_t at compile-time
https://git.kernel.org/kees/c/72a12a91a634

--
Kees Cook