Skip to content

Commit cc00550

Browse files
Vasily Gorbikhcahca
authored andcommitted
Revert "s390/mm: Allow large pages for KASAN shadow mapping"
This reverts commit ff123eb. Allowing large pages for KASAN shadow mappings isn't inherently wrong, but adding POPULATE_KASAN_MAP_SHADOW to large_allowed() exposes an issue in can_large_pud() and can_large_pmd(). Since commit d8073dc ("s390/mm: Allow large pages only for aligned physical addresses"), both can_large_pud() and can_large_pmd() call _pa() to check if large page physical addresses are aligned. However, _pa() has a side effect: it allocates memory in POPULATE_KASAN_MAP_SHADOW mode. This results in massive memory leaks. The proper fix would be to address both large_allowed() and _pa()'s side effects, but for now, revert this change to avoid the leaks. Fixes: ff123eb ("s390/mm: Allow large pages for KASAN shadow mapping") Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 889221c commit cc00550

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

arch/s390/boot/vmem.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,7 @@ 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-
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-
}
267+
return (mode == POPULATE_DIRECT) || (mode == POPULATE_IDENTITY) || (mode == POPULATE_KERNEL);
278268
}
279269

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

0 commit comments

Comments
 (0)