Skip to content

Commit 025375d

Browse files
Nicolas Pitreaescolar
authored andcommitted
boards: qemu: leon3: pass -m 1G to match DTS SRAM size
The qemu_leon3 DTS declares 1GB of SRAM (reg = <0x40000000 0x40000000>) but the QEMU command line never specified a -m option, so QEMU used its default of 128MB. This mismatch was silently tolerated until now because nothing validated the heap's end marker beyond physical RAM. When CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 (the default), the malloc heap claims the entire declared SRAM (~1GB). The heap end marker chunk is written at ~1GB offset from the heap base, well beyond QEMU's 128MB of physical RAM. Those writes are silently lost, leaving the end marker's LEFT_SIZE field as zero. Commit bec6349 ("lib: heap: introduce SYS_HEAP_HARDENING tiered Kconfig") made bidirectional size round-trip checks the default when CONFIG_ASSERT=y (MODERATE level). The check left_chunk(right_chunk(c)) reads back the end marker's LEFT_SIZE and detects the zero value, triggering "heap corruption (free chunk linkage)" across many unrelated tests on this board. Add -m 1G to the QEMU flags so the emulated RAM matches the declared DTS size, consistent with how other QEMU boards (arc, riscv32, x86) already specify their memory. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
1 parent 2d747e5 commit 025375d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

‎boards/qemu/leon3/board.cmake‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(QEMU_CPU_TYPE_${ARCH} leon3)
88
set(QEMU_FLAGS_${ARCH}
99
-nographic
1010
-machine leon3_generic
11+
-m 1G
1112
-icount auto
1213
)
1314
board_set_debugger_ifnset(qemu)

0 commit comments

Comments
 (0)