[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211018132341.865594008@linuxfoundation.org>
Date: Mon, 18 Oct 2021 15:23:35 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Kees Cook <keescook@...omium.org>,
Sami Tolvanen <samitolvanen@...gle.com>,
Miroslav Benes <mbenes@...e.cz>, Arnd Bergmann <arnd@...db.de>,
Jessica Yu <jeyu@...nel.org>
Subject: [PATCH 5.14 036/151] module: fix clang CFI with MODULE_UNLOAD=n
From: Arnd Bergmann <arnd@...db.de>
commit 0d67e332e6df72f43eaa21228daa3a79e23093f3 upstream.
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: cf68fffb66d6 ("add support for Clang CFI")
Acked-by: Kees Cook <keescook@...omium.org>
Reviewed-by: Sami Tolvanen <samitolvanen@...gle.com>
Reviewed-by: Miroslav Benes <mbenes@...e.cz>
Signed-off-by: Arnd Bergmann <arnd@...db.de>
Signed-off-by: Jessica Yu <jeyu@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
kernel/module.c | 2 ++
1 file changed, 2 insertions(+)
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4484,8 +4484,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
Powered by blists - more mailing lists