File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -264,12 +264,17 @@ void __init kasan_init(void)
264264
265265 /*
266266 * 1. The module global variables are in MODULES_VADDR ~ MODULES_END,
267- * so we need to map this area.
267+ * so we need to map this area if CONFIG_KASAN_VMALLOC=n. With
268+ * VMALLOC support KASAN will manage this region dynamically,
269+ * refer to kasan_populate_vmalloc() and ARM's implementation of
270+ * module_alloc().
268271 * 2. PKMAP_BASE ~ PKMAP_BASE+PMD_SIZE's shadow and MODULES_VADDR
269272 * ~ MODULES_END's shadow is in the same PMD_SIZE, so we can't
270273 * use kasan_populate_zero_shadow.
271274 */
272- create_mapping ((void * )MODULES_VADDR , (void * )(PKMAP_BASE + PMD_SIZE ));
275+ if (!IS_ENABLED (CONFIG_KASAN_VMALLOC ) && IS_ENABLED (CONFIG_MODULES ))
276+ create_mapping ((void * )MODULES_VADDR , (void * )(MODULES_END ));
277+ create_mapping ((void * )PKMAP_BASE , (void * )(PKMAP_BASE + PMD_SIZE ));
273278
274279 /*
275280 * KAsan may reuse the contents of kasan_early_shadow_pte directly, so
You can’t perform that action at this time.
0 commit comments