mm/memtest: the reserved-region array is reallocated inside the range under test

From: Norman Herms

Date: Mon Nov 23 2026 - 12:15:46 EST


Hi Mike,

On a board whose DRAM fails one word in every 256 bytes, memtest()
reserves every failing word on its own, 512 reservations over 1.6 MiB.
Past the 128 static entries, memblock_double_array() allocates the new
reserved array from free memory inside the range memtest() is still
reading back, and the array's own entries then fail the compare:
another 42 KiB at the top of RAM (0x1bf3c2000-0x1bf3cc800 here, inside
the tested range 0x60100000-0x1bf3cd040) is reserved as bad, in runs
of 16 bytes every 24 bytes, the size of struct memblock_region.

With memtest=4 the next pattern is written over the live array, and
the board resets during that pattern; we have not separated that from
a 16 s boot watchdog.

Coalescing nearby bad words, or reserving only after a range's verify
pass, would avoid it. Seen on 6.18.54 (arm64, Allwinner A733, 6 GiB);
mm/memtest.c is unchanged in linux-next.

Measured on my board by AI agents, analysis with an AI assistant;
a report, not a Tested-by.

Norman