lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250212-kunit-mips-v1-1-eb49c9d76615@linutronix.de>
Date: Wed, 12 Feb 2025 13:49:12 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>, 
 Paul Burton <paulburton@...nel.org>, 
 Brendan Higgins <brendan.higgins@...ux.dev>, 
 David Gow <davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>
Cc: linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org, 
 linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com, 
 Thomas Weißschuh <thomas.weissschuh@...utronix.de>, 
 Mike Rapoport <rppt@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, 
 linux-mm@...ck.org
Subject: [PATCH 1/2] MIPS: mm: Avoid blocking DMA zone with memory map
 memblock allocation

On MIPS the memblock allocator is configured to allocate bottom-up.
The memory map is allocated by the mm core through memblock and uses
MEMBLOCK_LOW_LIMIT as minimal address. This constant is defined as zero because
it assumes that "we are using top down, so it is safe to use 0 here".
So the memory map is allocated as close to 0 as possible, right where the DMA
zone will end up. As the memory map is allocated permanently and also larger
than the DMA zone, it makes the DMA zone unusable.

Temporarily switch to top-down allocation for the call to free_area_init() so
the memory map allocation does not fall into the DMA zone.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>

---

Another solution would be to change alloc_node_mem_map() in the mm core
to use __pa(MAX_DMA_ADDRESS) for the min_addr when calling
memmap_alloc(), as is done by the other callers of memmap_alloc().
Looping in the memblock maintainers for discussion.

This is reliably reproducible in QEMU. To reproduce, use the kunit
configuration from patch 2 of this series and run it like so:

./tools/testing/kunit/kunit.py run --arch mips64el --cross_compile $CROSS_COMPILE cs_dsp_wmfwV3_err_halo.wmfw_v2_coeff_description_exceeds_block

To: Mike Rapoport <rppt@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org
---
 arch/mips/mm/init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 4583d1a2a73e7ff36a42f6017d9aef008e45df6e..712eb4762917261416f1fca2d9925a42107ef6c1 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -435,7 +435,9 @@ void __init paging_init(void)
 #endif
 	high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
 
+	memblock_set_bottom_up(false);
 	free_area_init(max_zone_pfns);
+	memblock_set_bottom_up(true);
 }
 
 #ifdef CONFIG_64BIT

-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ