Re: [PATCH 04/15] static_call: Use global functions for the self-test
From: Thomas Gleixner
Date: Fri Apr 16 2021 - 17:37:27 EST
On Fri, Apr 16 2021 at 13:38, Sami Tolvanen wrote:
> With CONFIG_CFI_CLANG, the compiler renames static functions. This
> breaks static_call users using static functions, because the current
> implementation assumes functions have stable names by hardcoding them
> in inline assembly. Make the self-test functions global to prevent the
> compiler from renaming them.
Sorry, no.
> Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> ---
> kernel/static_call.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/static_call.c b/kernel/static_call.c
> index 723fcc9d20db..d09f500c2d2a 100644
> --- a/kernel/static_call.c
> +++ b/kernel/static_call.c
> @@ -503,12 +503,12 @@ long __static_call_return0(void)
>
> #ifdef CONFIG_STATIC_CALL_SELFTEST
>
> -static int func_a(int x)
> +int func_a(int x)
> {
> return x+1;
> }
>
> -static int func_b(int x)
> +int func_b(int x)
> {
> return x+2;
> }
Did you even compile that?
Global functions without a prototype are generating warnings, but we can
ignore them just because of sekurity, right?
Aside of that polluting the global namespace with func_a/b just to work
around a tool shortcoming is beyond hillarious.
Fix the tool not the perfectly correct code.
Thanks,
tglx