Skip to content

Commit ff123eb

Browse files
Vasily Gorbikhcahca
authored andcommitted
s390/mm: Allow large pages for KASAN shadow mapping
Commit c98d2ec ("s390/mm: Uncouple physical vs virtual address spaces") introduced a large_allowed() helper that restricts which mapping modes can use large pages. This change unintentionally prevented KASAN shadow mappings from using large pages, despite there being no reason to avoid them. In fact, large pages are preferred for performance. Add POPULATE_KASAN_MAP_SHADOW to the allowed list in large_allowed() to restore large page mappings for KASAN shadows. While large_allowed() isn't strictly necessary with current mapping modes since disallowed modes either don't map anything or fail alignment and size checks, keep it for clarity. Fixes: c98d2ec ("s390/mm: Uncouple physical vs virtual address spaces") Acked-by: Alexander Gordeev <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 9de3e4b commit ff123eb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/s390/boot/vmem.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,17 @@ static unsigned long _pa(unsigned long addr, unsigned long size, enum populate_m
264264

265265
static bool large_allowed(enum populate_mode mode)
266266
{
267-
return (mode == POPULATE_DIRECT) || (mode == POPULATE_IDENTITY) || (mode == POPULATE_KERNEL);
267+
switch (mode) {
268+
case POPULATE_DIRECT:
269+
case POPULATE_IDENTITY:
270+
case POPULATE_KERNEL:
271+
#ifdef CONFIG_KASAN
272+
case POPULATE_KASAN_MAP_SHADOW:
273+
#endif
274+
return true;
275+
default:
276+
return false;
277+
}
268278
}
269279

270280
static bool can_large_pud(pud_t *pu_dir, unsigned long addr, unsigned long end,

0 commit comments

Comments
 (0)