--- zzzz-none-000/linux-4.4.60/mm/kasan/kasan.c 2017-04-08 07:53:53.000000000 +0000 +++ scorpion-7490-727/linux-4.4.60/mm/kasan/kasan.c 2021-02-04 17:41:59.000000000 +0000 @@ -33,6 +33,8 @@ #include #include +#include + #include "kasan.h" #include "../slab.h" @@ -233,6 +235,20 @@ static __always_inline bool memory_is_poisoned(unsigned long addr, size_t size) { if (__builtin_constant_p(size)) { + if (IS_ENABLED(CONFIG_ARM)) { /* avoid alignment faults. */ + switch (size) { + case 1: + case 2: + case 4: + case 8: + return memory_is_poisoned_1(addr); + case 16: + return memory_is_poisoned_1(addr) + || memory_is_poisoned_1(addr + 8); + default: + BUILD_BUG(); + } + } switch (size) { case 1: return memory_is_poisoned_1(addr); @@ -252,7 +268,6 @@ return memory_is_poisoned_n(addr, size); } - static __always_inline void check_memory_region(unsigned long addr, size_t size, bool write) { @@ -461,6 +476,13 @@ static void register_global(struct kasan_global *global) { size_t aligned_size = round_up(global->size, KASAN_SHADOW_SCALE_SIZE); + /* + * Currently we do not allocate shadow for vmalloc area + * Skip globals that in modules in vmalloc area. + */ + if ((unsigned long)global->beg >= VMALLOC_START + && (unsigned long)global->beg < VMALLOC_END) + return; kasan_unpoison_shadow(global->beg, global->size);