arm64: kaslr: randomize the linear region
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 29 Jan 2016 10:59:03 +0000 (11:59 +0100)
committerAlex Shi <alex.shi@linaro.org>
Wed, 11 May 2016 15:18:46 +0000 (23:18 +0800)
commit98e23ea3a3dd23269a69282291f9bef53e262bc2
treeb19e48844313b71348f5bca41bb3d6db563b5e61
parentd0a12e9199c75cad71361f746ac40e4612945a43
arm64: kaslr: randomize the linear region

When KASLR is enabled (CONFIG_RANDOMIZE_BASE=y), and entropy has been
provided by the bootloader, randomize the placement of RAM inside the
linear region if sufficient space is available. For instance, on a 4KB
granule/3 levels kernel, the linear region is 256 GB in size, and we can
choose any 1 GB aligned offset that is far enough from the top of the
address space to fit the distance between the start of the lowest memblock
and the top of the highest memblock.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit c031a4213c11a5db475f528c182f7b3858df11db)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
arch/arm64/kernel/kaslr.c
arch/arm64/mm/init.c