Re: [PATCH] kernel/memremap, kasan: Make ZONE_DEVICE with work with KASAN
From: kbuild test robot
Date: Mon Jun 25 2018 - 15:52:29 EST
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: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.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=8.1.0 make.cross ARCH=xtensa
All error/warnings (new ones prefixed by >>):
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 'pud_alloc_one'? [-Werror=implicit-function-declaration]
p = p4d_alloc_one(&init_mm, addr);
^~~~~~~~~~~~~
pud_alloc_one
>> mm/kasan/kasan_init.c:267:7: warning: assignment to 'pgd_t *' {aka 'struct <anonymous> *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
p = p4d_alloc_one(&init_mm, addr);
^
cc1: some warnings being treated as errors
vim +267 mm/kasan/kasan_init.c
211
212 /**
213 * kasan_populate_zero_shadow - populate shadow memory region with
214 * kasan_zero_page
215 * @shadow_start - start of the memory range to populate
216 * @shadow_end - end of the memory range to populate
217 */
218 int __ref kasan_populate_zero_shadow(const void *shadow_start,
219 const void *shadow_end)
220 {
221 unsigned long addr = (unsigned long)shadow_start;
222 unsigned long end = (unsigned long)shadow_end;
223 pgd_t *pgd = pgd_offset_k(addr);
224 unsigned long next;
225
226 do {
227 next = pgd_addr_end(addr, end);
228
229 if (IS_ALIGNED(addr, PGDIR_SIZE) && end - addr >= PGDIR_SIZE) {
230 p4d_t *p4d;
231 pud_t *pud;
232 pmd_t *pmd;
233
234 /*
235 * kasan_zero_pud should be populated with pmds
236 * at this moment.
237 * [pud,pmd]_populate*() below needed only for
238 * 3,2 - level page tables where we don't have
239 * puds,pmds, so pgd_populate(), pud_populate()
240 * is noops.
241 *
242 * The ifndef is required to avoid build breakage.
243 *
244 * With 5level-fixup.h, pgd_populate() is not nop and
245 * we reference kasan_zero_p4d. It's not defined
246 * unless 5-level paging enabled.
247 *
248 * The ifndef can be dropped once all KASAN-enabled
249 * architectures will switch to pgtable-nop4d.h.
250 */
251 #ifndef __ARCH_HAS_5LEVEL_HACK
252 pgd_populate(&init_mm, pgd, lm_alias(kasan_zero_p4d));
253 #endif
254 p4d = p4d_offset(pgd, addr);
255 p4d_populate(&init_mm, p4d, lm_alias(kasan_zero_pud));
256 pud = pud_offset(p4d, addr);
257 pud_populate(&init_mm, pud, lm_alias(kasan_zero_pmd));
258 pmd = pmd_offset(pud, addr);
259 pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte));
260 continue;
261 }
262
263 if (pgd_none(*pgd)) {
264 p4d_t *p;
265
266 if (slab_is_available())
> 267 p = p4d_alloc_one(&init_mm, addr);
268 else
269 p = early_alloc(PAGE_SIZE, NUMA_NO_NODE);
270 if (!p)
271 return -ENOMEM;
272
273 pgd_populate(&init_mm, pgd, p);
274 }
275 zero_p4d_populate(pgd, addr, next);
276 } while (pgd++, addr = next, addr != end);
277
278 return 0;
279 }
280
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip