Re: [PATCH] modpost: add allow list for llvm IPSCCP

From: Linus Torvalds
Date: Wed Sep 29 2021 - 19:29:03 EST


On Wed, Sep 29, 2021 at 3:59 PM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> +static const struct secref_exception secref_allowlist[] = {
> + { .fromsym = "__first_node", .tosym = "numa_nodes_parsed" },
> + { .fromsym = "__next_node", .tosym = "numa_nodes_parsed" },
> + { .fromsym = "__nodes_weight", .tosym = "numa_nodes_parsed" },
> + { .fromsym = "early_get_smp_config", .tosym = "x86_init" },
> + { .fromsym = "test_bit", .tosym = "numa_nodes_parsed" },
> +};

This list is basically made-up and random.

Why did those functions not get inlined? Wouldn't it be better to make
them always-inline?

Or, like in at least the early_get_smp_config() case, just make it be
marked __init, so that if it doesn't get inlined it gets the right
section?

It seems silly to add random source mappings to a checking program.

It was bad for the gcc constprop hack, but at least there it was a
clear case of "this inlining failed". This ad-hoc list has cases of
things that are clearly wrong in general ("test_bit()" must not use
initdata), and that "ok, the function just doesn't have the right
section marker.

(All of get_smp_config/early_get_smp_config/find_smp_config should be
__init, since they most definitely cannot work after __init time - but
why a compiler doesn't just inline them when they are one single
indirect call, I don't really get)

Linus