Commit 0d67e332 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jessica Yu

module: fix clang CFI with MODULE_UNLOAD=n

When CONFIG_MODULE_UNLOAD is disabled, the module->exit member
is not defined, causing a build failure:

kernel/module.c:4493:8: error: no member named 'exit' in 'struct module'
                mod->exit = *exit;

add an #ifdef block around this.

Fixes: cf68fffb ("add support for Clang CFI")
Acked-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
parent 5816b3e6
...@@ -4489,8 +4489,10 @@ static void cfi_init(struct module *mod) ...@@ -4489,8 +4489,10 @@ static void cfi_init(struct module *mod)
/* Fix init/exit functions to point to the CFI jump table */ /* Fix init/exit functions to point to the CFI jump table */
if (init) if (init)
mod->init = *init; mod->init = *init;
#ifdef CONFIG_MODULE_UNLOAD
if (exit) if (exit)
mod->exit = *exit; mod->exit = *exit;
#endif
cfi_module_add(mod, module_addr_min); cfi_module_add(mod, module_addr_min);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment