[PATCH 6.12 582/590] Revert "s390/mm: Allow large pages for KASAN shadow mapping"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vasily Gorbik <gor@xxxxxxxxxxxxx>

commit cc00550b2ae7ab1c7c56669fc004a13d880aaf0a upstream.

This reverts commit ff123eb7741638d55abf82fac090bb3a543c1e74.

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 d8073dc6bc04 ("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: ff123eb77416 ("s390/mm: Allow large pages for KASAN shadow mapping")
Signed-off-by: Vasily Gorbik <gor@xxxxxxxxxxxxx>
Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/s390/boot/vmem.c |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

--- a/arch/s390/boot/vmem.c
+++ b/arch/s390/boot/vmem.c
@@ -264,17 +264,7 @@ static unsigned long _pa(unsigned long a
 
 static bool large_allowed(enum populate_mode mode)
 {
-	switch (mode) {
-	case POPULATE_DIRECT:
-	case POPULATE_IDENTITY:
-	case POPULATE_KERNEL:
-#ifdef CONFIG_KASAN
-	case POPULATE_KASAN_MAP_SHADOW:
-#endif
-		return true;
-	default:
-		return false;
-	}
+	return (mode == POPULATE_DIRECT) || (mode == POPULATE_IDENTITY) || (mode == POPULATE_KERNEL);
 }
 
 static bool can_large_pud(pud_t *pu_dir, unsigned long addr, unsigned long end,






[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux