Re-patching of module alternatives at runtime requires saving the ELF
information about where those alternatives (and returns, retpolines, etc.)
exist. This information is already saved for livepatch modules, so save it
as well if we may be doing dynamic mitigation reconfiguration.
Signed-off-by: David Kaplan <david.kaplan@amd.com>
---
kernel/module/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/module/main.c b/kernel/module/main.c
index c66b26184936..088f9399af11 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -3491,7 +3491,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
if (err < 0)
goto coming_cleanup;
- if (is_livepatch_module(mod)) {
+ if (IS_ENABLED(CONFIG_DYNAMIC_MITIGATIONS) || is_livepatch_module(mod)) {
err = copy_module_elf(mod, info);
if (err < 0)
goto sysfs_cleanup;
--
2.34.1