linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modules: page-align module section allocations only for arches supporting strict module rwx
@ 2019-08-20 14:53 zhe.he
  2019-08-21  8:51 ` Jessica Yu
  0 siblings, 1 reply; 2+ messages in thread
From: zhe.he @ 2019-08-20 14:53 UTC (permalink / raw)
  To: jeyu, linux-kernel, zhe.he

From: He Zhe <zhe.he@windriver.com>

We should keep the case of "#define debug_align(X) (X)" for all arches
without CONFIG_HAS_STRICT_MODULE_RWX ability, which would save people, who
are sensitive to system size, a lot of memory when using modules,
especially for embedded systems. This is also the intention of the
original #ifdef... statement and still valid for now.

Note that this still keeps the effect of the fix of the following commit,
38f054d549a8 ("modules: always page-align module section allocations"),
since when CONFIG_ARCH_HAS_STRICT_MODULE_RWX is enabled, module pages are
aligned.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
This patch is based on the top of modules-next tree, 38f054d549a8.

 kernel/module.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/module.c b/kernel/module.c
index cd8df51..9ee9342 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -64,9 +64,14 @@
 
 /*
  * Modules' sections will be aligned on page boundaries
- * to ensure complete separation of code and data
+ * to ensure complete separation of code and data, but
+ * only when CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
  */
+#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX
 # define debug_align(X) ALIGN(X, PAGE_SIZE)
+#else
+# define debug_align(X) (X)
+#endif
 
 /* If this is set, the section belongs in the init part of the module */
 #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] modules: page-align module section allocations only for arches supporting strict module rwx
  2019-08-20 14:53 [PATCH] modules: page-align module section allocations only for arches supporting strict module rwx zhe.he
@ 2019-08-21  8:51 ` Jessica Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Jessica Yu @ 2019-08-21  8:51 UTC (permalink / raw)
  To: zhe.he; +Cc: linux-kernel

+++ zhe.he@windriver.com [20/08/19 22:53 +0800]:
>From: He Zhe <zhe.he@windriver.com>
>
>We should keep the case of "#define debug_align(X) (X)" for all arches
>without CONFIG_HAS_STRICT_MODULE_RWX ability, which would save people, who
>are sensitive to system size, a lot of memory when using modules,
>especially for embedded systems. This is also the intention of the
>original #ifdef... statement and still valid for now.
>
>Note that this still keeps the effect of the fix of the following commit,
>38f054d549a8 ("modules: always page-align module section allocations"),
>since when CONFIG_ARCH_HAS_STRICT_MODULE_RWX is enabled, module pages are
>aligned.
>
>Signed-off-by: He Zhe <zhe.he@windriver.com>
>---
>This patch is based on the top of modules-next tree, 38f054d549a8.

I've applied this. Thanks!

Jessica

> kernel/module.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>diff --git a/kernel/module.c b/kernel/module.c
>index cd8df51..9ee9342 100644
>--- a/kernel/module.c
>+++ b/kernel/module.c
>@@ -64,9 +64,14 @@
>
> /*
>  * Modules' sections will be aligned on page boundaries
>- * to ensure complete separation of code and data
>+ * to ensure complete separation of code and data, but
>+ * only when CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
>  */
>+#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX
> # define debug_align(X) ALIGN(X, PAGE_SIZE)
>+#else
>+# define debug_align(X) (X)
>+#endif
>
> /* If this is set, the section belongs in the init part of the module */
> #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
>-- 
>2.7.4
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-21  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 14:53 [PATCH] modules: page-align module section allocations only for arches supporting strict module rwx zhe.he
2019-08-21  8:51 ` Jessica Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).