summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2019-08-02 18:37:28 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-08-02 18:37:28 -0400
commit02cc62643410e760ab6c8a42e4670bb736591f3f (patch)
treeb5ec640804c37f5734c91a0c95f26cd5877ce066
parent58d604b556d8c71a7146bb0e893ac1155a9ac6c8 (diff)
downloadlongterm-queue-4.18-02cc62643410e760ab6c8a42e4670bb736591f3f.tar.gz
modules: add fix for fix
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--queue/modules-fix-compile-error-if-don-t-have-strict-modul.patch68
-rw-r--r--queue/series1
2 files changed, 69 insertions, 0 deletions
diff --git a/queue/modules-fix-compile-error-if-don-t-have-strict-modul.patch b/queue/modules-fix-compile-error-if-don-t-have-strict-modul.patch
new file mode 100644
index 0000000..08bb84f
--- /dev/null
+++ b/queue/modules-fix-compile-error-if-don-t-have-strict-modul.patch
@@ -0,0 +1,68 @@
+From 93651f80dcb616b8c9115cdafc8e57a781af22d0 Mon Sep 17 00:00:00 2001
+From: Yang Yingliang <yangyingliang@huawei.com>
+Date: Tue, 25 Jun 2019 17:40:28 +0800
+Subject: [PATCH] modules: fix compile error if don't have strict module rwx
+
+commit 93651f80dcb616b8c9115cdafc8e57a781af22d0 upstream.
+
+If CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not defined,
+we need stub for module_enable_nx() and module_enable_x().
+
+If CONFIG_ARCH_HAS_STRICT_MODULE_RWX is defined, but
+CONFIG_STRICT_MODULE_RWX is disabled, we need stub for
+module_enable_nx.
+
+Move frob_text() outside of the CONFIG_STRICT_MODULE_RWX,
+because it is needed anyway.
+
+Fixes: 2eef1399a866 ("modules: fix BUG when load module with rodata=n")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+
+diff --git a/kernel/module.c b/kernel/module.c
+index 537c456ce3ee..b51838325d08 100644
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -1898,7 +1898,7 @@ static void mod_sysfs_teardown(struct module *mod)
+ mod_sysfs_fini(mod);
+ }
+
+-#ifdef CONFIG_STRICT_MODULE_RWX
++#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX
+ /*
+ * LKM RO/NX protection: protect module's text/ro-data
+ * from modification and any data from execution.
+@@ -1921,6 +1921,7 @@ static void frob_text(const struct module_layout *layout,
+ layout->text_size >> PAGE_SHIFT);
+ }
+
++#ifdef CONFIG_STRICT_MODULE_RWX
+ static void frob_rodata(const struct module_layout *layout,
+ int (*set_memory)(unsigned long start, int num_pages))
+ {
+@@ -2033,15 +2034,19 @@ void set_all_modules_text_ro(void)
+ }
+ mutex_unlock(&module_mutex);
+ }
+-#else
++#else /* !CONFIG_STRICT_MODULE_RWX */
+ static void module_enable_nx(const struct module *mod) { }
+-#endif
+-
++#endif /* CONFIG_STRICT_MODULE_RWX */
+ static void module_enable_x(const struct module *mod)
+ {
+ frob_text(&mod->core_layout, set_memory_x);
+ frob_text(&mod->init_layout, set_memory_x);
+ }
++#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
++static void module_enable_nx(const struct module *mod) { }
++static void module_enable_x(const struct module *mod) { }
++#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
++
+
+ #ifdef CONFIG_LIVEPATCH
+ /*
+--
+2.7.4
+
diff --git a/queue/series b/queue/series
index f93de69..75570ce 100644
--- a/queue/series
+++ b/queue/series
@@ -212,6 +212,7 @@ fuse-fallocate-fix-return-with-locked-inode.patch
intel_th-msu-Fix-single-mode-with-disabled-IOMMU.patch
media-stm32-dcmi-fix-irq-0-case.patch
modules-fix-BUG-when-load-module-with-rodata-n.patch
+modules-fix-compile-error-if-don-t-have-strict-modul.patch
NFS-Cleanup-if-nfs_match_client-is-interrupted.patch
Linux-4.18.41.patch