Skip to content

Commit

Permalink
modules: page-align module section allocations only for arches suppor…
Browse files Browse the repository at this point in the history
…ting strict module rwx

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,
38f054d ("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 <[email protected]>
Signed-off-by: Jessica Yu <[email protected]>
  • Loading branch information
He Zhe authored and Jessica Yu committed Aug 21, 2019
1 parent 38f054d commit 3b5be16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 3b5be16

Please sign in to comment.