Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kasan, module: move MODULE_ALIGN macro into <linux/moduleloader.h>

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@samsung.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andrey Ryabinin and committed by
Linus Torvalds
d3733e5c a5af5aa8

+8 -4
-4
include/linux/kasan.h
··· 50 50 void kasan_slab_alloc(struct kmem_cache *s, void *object); 51 51 void kasan_slab_free(struct kmem_cache *s, void *object); 52 52 53 - #define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT) 54 - 55 53 int kasan_module_alloc(void *addr, size_t size); 56 54 void kasan_free_shadow(const struct vm_struct *vm); 57 55 58 56 #else /* CONFIG_KASAN */ 59 - 60 - #define MODULE_ALIGN 1 61 57 62 58 static inline void kasan_unpoison_shadow(const void *address, size_t size) {} 63 59
+8
include/linux/moduleloader.h
··· 84 84 85 85 /* Any cleanup before freeing mod->module_init */ 86 86 void module_arch_freeing_init(struct module *mod); 87 + 88 + #ifdef CONFIG_KASAN 89 + #include <linux/kasan.h> 90 + #define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT) 91 + #else 92 + #define MODULE_ALIGN PAGE_SIZE 93 + #endif 94 + 87 95 #endif