]> git.hungrycats.org Git - linux/commitdiff
modpost: disallow the combination of EXPORT_SYMBOL and __meminit*
authorMasahiro Yamada <masahiroy@kernel.org>
Sun, 22 Oct 2023 17:06:10 +0000 (02:06 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Dec 2024 09:32:58 +0000 (10:32 +0100)
[ Upstream commit a3df1526da480c089c20868b7f4d486b9f266001 ]

Theoretically, we could export conditionally-discarded code sections,
such as .meminit*, if all the users can become modular under a certain
condition. However, that would be difficult to control and such a tricky
case has never occurred.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: bb43a59944f4 ("Rename .data.unlikely to .data..unlikely")
Signed-off-by: Sasha Levin <sashal@kernel.org>
scripts/mod/modpost.c

index 0426c1bf3a69c014942e0b36bebca73eb6721a55..c4c09e28dc9025038da8158e6f8e2c15d5c7f677 100644 (file)
@@ -1176,7 +1176,7 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
            ELF_ST_TYPE(sym->st_info) == STT_LOPROC)
                s->is_func = true;
 
-       if (match(secname, PATTERNS(INIT_SECTIONS)))
+       if (match(secname, PATTERNS(ALL_INIT_SECTIONS)))
                warn("%s: %s: EXPORT_SYMBOL used for init symbol. Remove __init or EXPORT_SYMBOL.\n",
                     mod->name, name);
        else if (match(secname, PATTERNS(ALL_EXIT_SECTIONS)))