module: fix clang CFI with MODULE_UNLOAD=n
PATCH 1/1 module: fix clang CFI with MODULE_UNLOAD=n
From: Arnd Bergmann <[email protected]>
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.
--- kernel/module.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/module.c +2 -0
@@ -4489,8 +4489,10 @@ static void cfi_init(struct module *mod)/* Fix init/exit functions to point to the CFI jump table */ if (init) mod->init = *init; +#ifdef CONFIG_MODULE_UNLOAD if (exit) mod->exit = *exit; +#endif cfi_module_add (mod, module_addr_min);#endif
Signature · 1 line
2.29.2
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When
CONFIG_MODULE_UNLOADis disabled, themodule->exitmember is not defined, causing a build failure:
Quoted 7 lines
kernel/module.c:4493:8: error: no member named 'exit' in 'struct module'mod->exit = *exit;add an #ifdef block around this.
Fixes cf68fffb66d6 ("add support for Clang CFI")Signed-off-by Arnd Bergmann <[email protected]>
M
Hi Arnd,
Quoted 22 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When
CONFIG_MODULE_UNLOADis disabled, themodule->exitmember 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 cf68fffb66d6 ("add support for Clang CFI")Signed-off-by Arnd Bergmann <[email protected]>--- kernel/module.c | 2 ++ 1 file changed, 2 insertions(+)kernel/module.c +0
-0
kernel/module.c static void cfi_init(struct module *mod) · line 4498
Quoted 10 lines
kernel/module.c +2
-0@@ -4489,8 +4489,10 @@ static void cfi_init(struct module *mod)/* Fix init/exit functions to point to the CFI jump table */ if (init) mod->init = *init; +#ifdef CONFIG_MODULE_UNLOAD if (exit) mod->exit = *exit; +#endif cfi_module_add (mod, module_addr_min);#endif
Thanks for the fix!
Sami
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When
CONFIG_MODULE_UNLOADis disabled, themodule->exitmember is not defined, causing a build failure:
Quoted 7 lines
kernel/module.c:4493:8: error: no member named 'exit' in 'struct module'mod->exit = *exit;add an #ifdef block around this.
Fixes cf68fffb66d6 ("add support for Clang CFI")Signed-off-by Arnd Bergmann <[email protected]>
Nice catch; thanks! (Not a lot of config build that way it seems...)
Signature · 1 line
Kees Cook
Jessica Yu
Applied+++ Arnd Bergmann [27/09/21 14:15 +0200]:
Quoted 5 lines
From: Arnd Bergmann <[email protected]>
When
CONFIG_MODULE_UNLOADis disabled, themodule->exitmember is not defined, causing a build failure:
Quoted 7 lines
kernel/module.c:4493:8: error: no member named 'exit' in 'struct module'mod->exit = *exit;add an #ifdef block around this.
Fixes cf68fffb66d6 ("add support for Clang CFI")Signed-off-by Arnd Bergmann <[email protected]>
Applied, thanks everyone!
Jessica