[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201806260417.WZzfF9jA%fengguang.wu@intel.com>
Date: Tue, 26 Jun 2018 04:15:11 +0800
From: kbuild test robot <lkp@...el.com>
To: Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc: kbuild-all@...org, Andrew Morton <akpm@...ux-foundation.org>,
Dave Chinner <david@...morbit.com>, kasan-dev@...glegroups.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Dan Williams <dan.j.williams@...el.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Alexander Potapenko <glider@...gle.com>
Subject: Re: [PATCH] kernel/memremap, kasan: Make ZONE_DEVICE with work with
KASAN
Hi Andrey,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc2]
[cannot apply to next-20180625]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/kernel-memremap-kasan-Make-ZONE_DEVICE-with-work-with-KASAN/20180626-023131
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 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
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=arm64
All error/warnings (new ones prefixed by >>):
In file included from arch/arm64/include/asm/thread_info.h:30:0,
from include/linux/thread_info.h:38,
from include/asm-generic/preempt.h:5,
from ./arch/arm64/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/spinlock.h:51,
from include/linux/mmzone.h:8,
from include/linux/bootmem.h:8,
from mm/kasan/kasan_init.c:13:
mm/kasan/kasan_init.c: In function 'kasan_pmd_table':
>> mm/kasan/kasan_init.c:63:14: error: implicit declaration of function 'pud_page_vaddr'; did you mean 'pud_page_paddr'? [-Werror=implicit-function-declaration]
return __pa(pud_page_vaddr(pud)) == __pa_symbol(kasan_zero_pmd);
^
arch/arm64/include/asm/memory.h:270:50: note: in definition of macro '__pa'
#define __pa(x) __virt_to_phys((unsigned long)(x))
^
mm/kasan/kasan_init.c: In function 'kasan_pte_table':
>> mm/kasan/kasan_init.c:75:14: error: implicit declaration of function 'pmd_page_vaddr'; did you mean 'pmd_page_paddr'? [-Werror=implicit-function-declaration]
return __pa(pmd_page_vaddr(pmd)) == __pa_symbol(kasan_zero_pte);
^
arch/arm64/include/asm/memory.h:270:50: note: in definition of macro '__pa'
#define __pa(x) __virt_to_phys((unsigned long)(x))
^
mm/kasan/kasan_init.c: In function 'zero_pmd_populate':
mm/kasan/kasan_init.c:122:8: error: implicit declaration of function 'slab_is_available'; did you mean 'si_mem_available'? [-Werror=implicit-function-declaration]
if (slab_is_available())
^~~~~~~~~~~~~~~~~
si_mem_available
mm/kasan/kasan_init.c: In function 'kasan_populate_zero_shadow':
>> mm/kasan/kasan_init.c:267:9: error: implicit declaration of function 'p4d_alloc_one'; did you mean 'pmd_alloc_one'? [-Werror=implicit-function-declaration]
p = p4d_alloc_one(&init_mm, addr);
^~~~~~~~~~~~~
pmd_alloc_one
>> mm/kasan/kasan_init.c:267:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
p = p4d_alloc_one(&init_mm, addr);
^
mm/kasan/kasan_init.c: In function 'kasan_free_pte':
>> mm/kasan/kasan_init.c:292:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
pte_free_kernel(&init_mm, (pte_t *)pmd_page_vaddr(*pmd));
^
mm/kasan/kasan_init.c: In function 'kasan_free_pmd':
mm/kasan/kasan_init.c:307:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
pmd_free(&init_mm, (pmd_t *)pud_page_vaddr(*pud));
^
cc1: some warnings being treated as errors
vim +63 mm/kasan/kasan_init.c
> 13 #include <linux/bootmem.h>
14 #include <linux/init.h>
15 #include <linux/kasan.h>
16 #include <linux/kernel.h>
17 #include <linux/memblock.h>
18 #include <linux/mm.h>
19 #include <linux/pfn.h>
20
21 #include <asm/page.h>
22 #include <asm/pgalloc.h>
23
24 #include "kasan.h"
25
26 /*
27 * This page serves two purposes:
28 * - It used as early shadow memory. The entire shadow region populated
29 * with this page, before we will be able to setup normal shadow memory.
30 * - Latter it reused it as zero shadow to cover large ranges of memory
31 * that allowed to access, but not handled by kasan (vmalloc/vmemmap ...).
32 */
33 unsigned char kasan_zero_page[PAGE_SIZE] __page_aligned_bss;
34
35 #if CONFIG_PGTABLE_LEVELS > 4
36 p4d_t kasan_zero_p4d[MAX_PTRS_PER_P4D] __page_aligned_bss;
37 static inline bool kasan_p4d_table(pgd_t pgd)
38 {
39 return __pa(pgd_page_vaddr(pgd)) == __pa_symbol(kasan_zero_p4d);
40 }
41 #else
42 static inline bool kasan_p4d_table(pgd_t pgd)
43 {
44 return 0;
45 }
46 #endif
47 #if CONFIG_PGTABLE_LEVELS > 3
48 pud_t kasan_zero_pud[PTRS_PER_PUD] __page_aligned_bss;
49 static inline bool kasan_pud_table(p4d_t p4d)
50 {
51 return __pa(p4d_page_vaddr(p4d)) == __pa_symbol(kasan_zero_pud);
52 }
53 #else
54 static inline bool kasan_pud_table(p4d_t p4d)
55 {
56 return 0;
57 }
58 #endif
59 #if CONFIG_PGTABLE_LEVELS > 2
60 pmd_t kasan_zero_pmd[PTRS_PER_PMD] __page_aligned_bss;
61 static inline bool kasan_pmd_table(pud_t pud)
62 {
> 63 return __pa(pud_page_vaddr(pud)) == __pa_symbol(kasan_zero_pmd);
64 }
65 #else
66 static inline bool kasan_pmd_table(pud_t pud)
67 {
68 return 0;
69 }
70 #endif
71 pte_t kasan_zero_pte[PTRS_PER_PTE] __page_aligned_bss;
72
73 static inline bool kasan_pte_table(pmd_t pmd)
74 {
> 75 return __pa(pmd_page_vaddr(pmd)) == __pa_symbol(kasan_zero_pte);
76 }
77
78 static inline bool kasan_zero_page_entry(pte_t pte)
79 {
80 return pte_pfn(pte) == PHYS_PFN(__pa_symbol(kasan_zero_page));
81 }
82
83 static __init void *early_alloc(size_t size, int node)
84 {
85 return memblock_virt_alloc_try_nid(size, size, __pa(MAX_DMA_ADDRESS),
86 BOOTMEM_ALLOC_ACCESSIBLE, node);
87 }
88
89 static void __ref zero_pte_populate(pmd_t *pmd, unsigned long addr,
90 unsigned long end)
91 {
92 pte_t *pte = pte_offset_kernel(pmd, addr);
93 pte_t zero_pte;
94
95 zero_pte = pfn_pte(PFN_DOWN(__pa_symbol(kasan_zero_page)), PAGE_KERNEL);
96 zero_pte = pte_wrprotect(zero_pte);
97
98 while (addr + PAGE_SIZE <= end) {
99 set_pte_at(&init_mm, addr, pte, zero_pte);
100 addr += PAGE_SIZE;
101 pte = pte_offset_kernel(pmd, addr);
102 }
103 }
104
105 static int __ref zero_pmd_populate(pud_t *pud, unsigned long addr,
106 unsigned long end)
107 {
108 pmd_t *pmd = pmd_offset(pud, addr);
109 unsigned long next;
110
111 do {
112 next = pmd_addr_end(addr, end);
113
114 if (IS_ALIGNED(addr, PMD_SIZE) && end - addr >= PMD_SIZE) {
115 pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte));
116 continue;
117 }
118
119 if (pmd_none(*pmd)) {
120 pte_t *p;
121
> 122 if (slab_is_available())
123 p = pte_alloc_one_kernel(&init_mm, addr);
124 else
125 p = early_alloc(PAGE_SIZE, NUMA_NO_NODE);
126 if (!p)
127 return -ENOMEM;
128
129 pmd_populate_kernel(&init_mm, pmd, p);
130 }
131 zero_pte_populate(pmd, addr, next);
132 } while (pmd++, addr = next, addr != end);
133
134 return 0;
135 }
136
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (60340 bytes)
Powered by blists - more mailing lists