[Devel] [PATCH RHEL7 COMMIT] ms/kasan, module: move MODULE_ALIGN macro into <linux/moduleloader.h>

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 3 08:27:47 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.6
------>
commit 5ad7c91c09ff6978e0c5df0fd4b25e7baa6eee87
Author: Andrey Ryabinin <aryabinin at odin.com>
Date:   Thu Sep 3 19:27:47 2015 +0400

    ms/kasan, module: move MODULE_ALIGN macro into <linux/moduleloader.h>
    
    https://jira.sw.ru/browse/PSBM-26429
    
    From: Andrey Ryabinin <a.ryabinin at samsung.com>
    
    commit d3733e5c98e952d419e77fa721912f09d15a2806 upstream.
    
    include/linux/moduleloader.h is more suitable place for this macro.
    Also change alignment to PAGE_SIZE for CONFIG_KASAN=n as such
    alignment already assumed in several places.
    
    Signed-off-by: Andrey Ryabinin <a.ryabinin at samsung.com>
    Cc: Dmitry Vyukov <dvyukov at google.com>
    Acked-by: Rusty Russell <rusty at rustcorp.com.au>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    Signed-off-by: Andrey Ryabinin <aryabinin at odin.com>
    
    Signed-off-by: Andrey Ryabinin <aryabinin at odin.com>
---
 include/linux/kasan.h        | 4 ----
 include/linux/moduleloader.h | 7 +++++++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 5fa48a2..5bb0744 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -50,15 +50,11 @@ void kasan_krealloc(const void *object, size_t new_size);
 void kasan_slab_alloc(struct kmem_cache *s, void *object);
 void kasan_slab_free(struct kmem_cache *s, void *object);
 
-#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
-
 int kasan_module_alloc(void *addr, size_t size);
 void kasan_free_shadow(const struct vm_struct *vm);
 
 #else /* CONFIG_KASAN */
 
-#define MODULE_ALIGN 1
-
 static inline void kasan_unpoison_shadow(const void *address, size_t size) {}
 
 static inline void kasan_enable_current(void) {}
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index 560ca53..8405769 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -80,4 +80,11 @@ int module_finalize(const Elf_Ehdr *hdr,
 /* Any cleanup needed when module leaves. */
 void module_arch_cleanup(struct module *mod);
 
+#ifdef CONFIG_KASAN
+#include <linux/kasan.h>
+#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
+#else
+#define MODULE_ALIGN PAGE_SIZE
+#endif
+
 #endif



More information about the Devel mailing list