Re: [PATCH] arm64: kaslr: Reserve size of ARM64_MEMSTART_ALIGN in linear region

From: Sasha Levin
Date: Sat Apr 13 2019 - 10:38:49 EST


On Sat, Apr 13, 2019 at 08:41:33PM +0800, Nicolas Boichat wrote:
Dear stable maintainers,

I encountered a similar issue on a 4.19.33 kernel (Chromium OS). On my
board, the system would not even be able to boot if KASLR decides to
map the linear region to the top of the virtual address space. This
happens every 253 boots on average (there are 0xfd possible random
offsets, and only the top one fails).

I tried to debug the issue, and it appears physical memory allocated
for vmemmap and mem_section array would end up at the same location,
corrupting each other early on boot. I could not figure out exactly
why this is happening, but in any case, this patch fixes my issue (no
failure in 744 reboots with 240 unique offsets, and counting...), and
IMHO the ERR_PTR justification in the commit message is enough to
warrant inclusion in -stable branches.

The patch below was committed to mainline as:
commit c8a43c18a97845e7f94ed7d181c11f41964976a2
arm64: kaslr: Reserve size of ARM64_MEMSTART_ALIGN in linear region

and should be included in stable branches after this commit:
Fixes: c031a4213c11a5db ("arm64: kaslr: randomize the linear region")
i.e. anything after kernel 4.5 (git describe says v4.5-rc4-62-gc031a4213c11a5d).

I've queued it for 4.9-4.19, thanks for the report.

--
Thanks,
Sasha