From fb568b9673331b0a87fd36cbc2a9e5a0e20ad3c5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 17 Oct 2021 16:58:05 +0200 Subject: [PATCH] 5.14-stable patches added patches: module-fix-clang-cfi-with-module_unload-n.patch --- ...e-fix-clang-cfi-with-module_unload-n.patch | 41 +++++++++++++++++++ queue-5.14/series | 1 + 2 files changed, 42 insertions(+) create mode 100644 queue-5.14/module-fix-clang-cfi-with-module_unload-n.patch diff --git a/queue-5.14/module-fix-clang-cfi-with-module_unload-n.patch b/queue-5.14/module-fix-clang-cfi-with-module_unload-n.patch new file mode 100644 index 00000000000..ed24f0bfdc1 --- /dev/null +++ b/queue-5.14/module-fix-clang-cfi-with-module_unload-n.patch @@ -0,0 +1,41 @@ +From 0d67e332e6df72f43eaa21228daa3a79e23093f3 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 27 Sep 2021 14:15:10 +0200 +Subject: module: fix clang CFI with MODULE_UNLOAD=n + +From: Arnd Bergmann + +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 +Reviewed-by: Sami Tolvanen +Reviewed-by: Miroslav Benes +Signed-off-by: Arnd Bergmann +Signed-off-by: Jessica Yu +Signed-off-by: Greg Kroah-Hartman +--- + 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 diff --git a/queue-5.14/series b/queue-5.14/series index 6dc8f93f300..e93fb4af564 100644 --- a/queue-5.14/series +++ b/queue-5.14/series @@ -33,3 +33,4 @@ btrfs-deal-with-errors-when-adding-inode-reference-during-log-replay.patch btrfs-check-for-error-when-looking-up-inode-during-dir-entry-replay.patch btrfs-update-refs-for-any-root-except-tree-log-roots.patch btrfs-fix-abort-logic-in-btrfs_replace_file_extents.patch +module-fix-clang-cfi-with-module_unload-n.patch -- 2.47.3