tree: git://git.cmpxchg.org/linux-mmotm.git master head: bf384e483e31f8e2fc27d5fdb5236b2e9d3fdc84 commit: 0e167d1cc70a033cf3dd6ef3b84599b029f5981a [15/198] kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage config: xtensa-allyesconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 0e167d1cc70a033cf3dd6ef3b84599b029f5981a # save the attached .config to linux build tree make.cross ARCH=xtensa All errors (new ones prefixed by >>): In file included from include/linux/slab.h:129:0, from include/linux/irq.h:26, from include/asm-generic/hardirq.h:13, from ./arch/xtensa/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:9, from include/linux/interrupt.h:13, from mm/kasan/kasan.c:20: include/linux/kasan.h: In function 'kasan_mem_to_shadow': include/linux/kasan.h:28:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_START'? return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT) ^~~~~~~~~~~~~~~~~~~~~~~~ KASAN_SHADOW_START include/linux/kasan.h:28:41: note: each undeclared identifier is reported only once for each function it appears in In file included from mm/kasan/kasan.c:40:0: mm/kasan/kasan.h: In function 'kasan_shadow_to_mem': >> mm/kasan/kasan.h:105:6: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? << KASAN_SHADOW_SCALE_SHIFT); ^~~~~~~~~~~~~~~~~~~~~~~~ KASAN_SHADOW_SCALE_SIZE mm/kasan/kasan.c: In function 'kasan_unpoison_shadow': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ mm/kasan/kasan.h:9:34: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' #define KASAN_SHADOW_MASK (KASAN_SHADOW_SCALE_SIZE - 1) ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c:71:13: note: in expansion of macro 'KASAN_SHADOW_MASK' if (size & KASAN_SHADOW_MASK) { ^~~~~~~~~~~~~~~~~ mm/kasan/kasan.c: In function 'memory_is_poisoned_1': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ mm/kasan/kasan.h:9:34: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' #define KASAN_SHADOW_MASK (KASAN_SHADOW_SCALE_SIZE - 1) ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c:130:36: note: in expansion of macro 'KASAN_SHADOW_MASK' s8 last_accessible_byte = addr & KASAN_SHADOW_MASK; ^~~~~~~~~~~~~~~~~ In file included from include/linux/kernel.h:10:0, from include/linux/interrupt.h:6, from mm/kasan/kasan.c:20: mm/kasan/kasan.c: In function 'memory_is_poisoned_2_4_8': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/compiler.h:77:42: note: in definition of macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ mm/kasan/kasan.h:9:34: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' #define KASAN_SHADOW_MASK (KASAN_SHADOW_SCALE_SIZE - 1) ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c:146:36: note: in expansion of macro 'KASAN_SHADOW_MASK' if (unlikely(((addr + size - 1) & KASAN_SHADOW_MASK) < size - 1)) ^~~~~~~~~~~~~~~~~ mm/kasan/kasan.c: In function 'memory_is_poisoned_16': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/compiler.h:77:42: note: in definition of macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ mm/kasan/kasan.c:157:16: note: in expansion of macro 'IS_ALIGNED' if (unlikely(!IS_ALIGNED(addr, KASAN_SHADOW_SCALE_SIZE))) ^~~~~~~~~~ mm/kasan/kasan.c:157:33: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' if (unlikely(!IS_ALIGNED(addr, KASAN_SHADOW_SCALE_SIZE))) ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c: In function 'memory_is_poisoned_n': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/compiler.h:77:42: note: in definition of macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ mm/kasan/kasan.h:9:34: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' #define KASAN_SHADOW_MASK (KASAN_SHADOW_SCALE_SIZE - 1) ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c:218:24: note: in expansion of macro 'KASAN_SHADOW_MASK' ((long)(last_byte & KASAN_SHADOW_MASK) >= *last_shadow))) ^~~~~~~~~~~~~~~~~ In file included from include/linux/interrupt.h:6:0, from mm/kasan/kasan.c:20: mm/kasan/kasan.c: In function 'kasan_cache_create': include/linux/kernel.h:792:16: warning: comparison of distinct pointer types lacks a cast (void) (&min1 == &min2); \ ^ include/linux/kernel.h:801:2: note: in expansion of macro '__min' __min(typeof(x), typeof(y), \ ^~~~~ mm/kasan/kasan.c:361:10: note: in expansion of macro 'min' *size = min(KMALLOC_MAX_SIZE, max(*size, cache->object_size + ^~~ In file included from include/linux/interrupt.h:6:0, from mm/kasan/kasan.c:20: mm/kasan/kasan.c: In function 'kasan_poison_object_data': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/kernel.h:86:46: note: in definition of macro '__round_mask' #define __round_mask(x, y) ((__typeof__(x))((y)-1)) ^ mm/kasan/kasan.c:411:4: note: in expansion of macro 'round_up' round_up(cache->object_size, KASAN_SHADOW_SCALE_SIZE), ^~~~~~~~ mm/kasan/kasan.c:411:33: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' round_up(cache->object_size, KASAN_SHADOW_SCALE_SIZE), ^~~~~~~~~~~~~~~~~~~~~~~ In file included from mm/kasan/kasan.c:40:0: mm/kasan/kasan.c: In function '__kasan_slab_free': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ mm/kasan/kasan.c:509:40: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' if (shadow_byte < 0 || shadow_byte >= KASAN_SHADOW_SCALE_SIZE) { ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/interrupt.h:6:0, from mm/kasan/kasan.c:20: mm/kasan/kasan.c: In function 'kasan_kmalloc': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/kernel.h:86:46: note: in definition of macro '__round_mask' #define __round_mask(x, y) ((__typeof__(x))((y)-1)) ^ mm/kasan/kasan.c:542:18: note: in expansion of macro 'round_up' redzone_start = round_up((unsigned long)(object + size), ^~~~~~~~ mm/kasan/kasan.c:543:5: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' KASAN_SHADOW_SCALE_SIZE); ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c: In function 'kasan_kmalloc_large': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/kernel.h:86:46: note: in definition of macro '__round_mask' #define __round_mask(x, y) ((__typeof__(x))((y)-1)) ^ mm/kasan/kasan.c:569:18: note: in expansion of macro 'round_up' redzone_start = round_up((unsigned long)(ptr + size), ^~~~~~~~ mm/kasan/kasan.c:570:5: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' KASAN_SHADOW_SCALE_SIZE); ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c: In function 'kasan_module_alloc': >> mm/kasan/kasan.c:625:33: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? shadow_size = round_up(size >> KASAN_SHADOW_SCALE_SHIFT, ^ include/linux/kernel.h:87:28: note: in definition of macro 'round_up' #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) ^ mm/kasan/kasan.c: In function 'register_global': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/kernel.h:86:46: note: in definition of macro '__round_mask' #define __round_mask(x, y) ((__typeof__(x))((y)-1)) ^ mm/kasan/kasan.c:654:24: note: in expansion of macro 'round_up' size_t aligned_size = round_up(global->size, KASAN_SHADOW_SCALE_SIZE); ^~~~~~~~ mm/kasan/kasan.c:654:47: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' size_t aligned_size = round_up(global->size, KASAN_SHADOW_SCALE_SIZE); ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c: In function '__asan_poison_stack_memory': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/kernel.h:86:46: note: in definition of macro '__round_mask' #define __round_mask(x, y) ((__typeof__(x))((y)-1)) ^ mm/kasan/kasan.c:732:28: note: in expansion of macro 'round_up' kasan_poison_shadow(addr, round_up(size, KASAN_SHADOW_SCALE_SIZE), ^~~~~~~~ mm/kasan/kasan.c:732:43: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' kasan_poison_shadow(addr, round_up(size, KASAN_SHADOW_SCALE_SIZE), ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/kasan.c: In function '__asan_alloca_poison': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ include/linux/kernel.h:86:46: note: in definition of macro '__round_mask' #define __round_mask(x, y) ((__typeof__(x))((y)-1)) ^ mm/kasan/kasan.c:747:27: note: in expansion of macro 'round_up' size_t rounded_up_size = round_up(size, KASAN_SHADOW_SCALE_SIZE); ^~~~~~~~ mm/kasan/kasan.c:747:42: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' size_t rounded_up_size = round_up(size, KASAN_SHADOW_SCALE_SIZE); ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/slab.h:129:0, from include/linux/irq.h:26, from include/asm-generic/hardirq.h:13, from ./arch/xtensa/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:9, from include/linux/interrupt.h:13, from mm/kasan/kasan.c:20: include/linux/kasan.h: In function 'kasan_mem_to_shadow': include/linux/kasan.h:30:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from mm/kasan/kasan.c:40:0: mm/kasan/kasan.h: In function 'kasan_shadow_to_mem': mm/kasan/kasan.h:106:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ -- In file included from include/linux/slab.h:129:0, from mm/kasan/report.c:23: include/linux/kasan.h: In function 'kasan_mem_to_shadow': include/linux/kasan.h:28:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_START'? return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT) ^~~~~~~~~~~~~~~~~~~~~~~~ KASAN_SHADOW_START include/linux/kasan.h:28:41: note: each undeclared identifier is reported only once for each function it appears in In file included from mm/kasan/report.c:33:0: mm/kasan/kasan.h: In function 'kasan_shadow_to_mem': >> mm/kasan/kasan.h:105:6: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? << KASAN_SHADOW_SCALE_SHIFT); ^~~~~~~~~~~~~~~~~~~~~~~~ KASAN_SHADOW_SCALE_SIZE mm/kasan/report.c: In function 'find_first_bad_addr': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ mm/kasan/report.c:48:21: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' first_bad_addr += KASAN_SHADOW_SCALE_SIZE; ^~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/report.c: In function 'get_shadow_bug_type': mm/kasan/kasan.h:8:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? #define KASAN_SHADOW_SCALE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) ^ mm/kasan/report.c:74:42: note: in expansion of macro 'KASAN_SHADOW_SCALE_SIZE' if (*shadow_addr > 0 && *shadow_addr <= KASAN_SHADOW_SCALE_SIZE - 1) ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/slab.h:129:0, from mm/kasan/report.c:23: include/linux/kasan.h: In function 'kasan_mem_to_shadow': include/linux/kasan.h:30:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from mm/kasan/report.c:33:0: mm/kasan/kasan.h: In function 'kasan_shadow_to_mem': mm/kasan/kasan.h:106:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ -- In file included from include/linux/slab.h:129:0, from mm/kasan/quarantine.c:27: include/linux/kasan.h: In function 'kasan_mem_to_shadow': include/linux/kasan.h:28:41: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_START'? return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT) ^~~~~~~~~~~~~~~~~~~~~~~~ KASAN_SHADOW_START include/linux/kasan.h:28:41: note: each undeclared identifier is reported only once for each function it appears in In file included from mm/kasan/quarantine.c:33:0: mm/kasan/kasan.h: In function 'kasan_shadow_to_mem': >> mm/kasan/kasan.h:105:6: error: 'KASAN_SHADOW_SCALE_SHIFT' undeclared (first use in this function); did you mean 'KASAN_SHADOW_SCALE_SIZE'? << KASAN_SHADOW_SCALE_SHIFT); ^~~~~~~~~~~~~~~~~~~~~~~~ KASAN_SHADOW_SCALE_SIZE vim +105 mm/kasan/kasan.h 7ed2f9e6 Alexander Potapenko 2016-03-25 96 7ed2f9e6 Alexander Potapenko 2016-03-25 97 struct kasan_alloc_meta *get_alloc_info(struct kmem_cache *cache, 7ed2f9e6 Alexander Potapenko 2016-03-25 98 const void *object); 7ed2f9e6 Alexander Potapenko 2016-03-25 99 struct kasan_free_meta *get_free_info(struct kmem_cache *cache, 7ed2f9e6 Alexander Potapenko 2016-03-25 100 const void *object); 7ed2f9e6 Alexander Potapenko 2016-03-25 101 0b24becc Andrey Ryabinin 2015-02-13 102 static inline const void *kasan_shadow_to_mem(const void *shadow_addr) 0b24becc Andrey Ryabinin 2015-02-13 103 { 0b24becc Andrey Ryabinin 2015-02-13 104 return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET) 0b24becc Andrey Ryabinin 2015-02-13 @105 << KASAN_SHADOW_SCALE_SHIFT); 0b24becc Andrey Ryabinin 2015-02-13 106 } 0b24becc Andrey Ryabinin 2015-02-13 107 :::::: The code at line 105 was first introduced by commit :::::: 0b24becc810dc3be6e3f94103a866f214c282394 kasan: add kernel address sanitizer infrastructure :::::: TO: Andrey Ryabinin <a.ryabinin@xxxxxxxxxxx> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip