summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYueyi Li2018-12-24 08:40:07 +0100
committerGreg Kroah-Hartman2019-04-17 08:38:46 +0200
commit902eaef7781cef521dba7e0299b24e5f4b78b688 (patch)
tree8eedaa0b27324aa908dd28bd90972e9cbe26fba2
parentnetfilter: nfnetlink_cttimeout: fetch timeouts for udplite and gre, too (diff)
downloadkernel-qcow2-linux-902eaef7781cef521dba7e0299b24e5f4b78b688.tar.gz
kernel-qcow2-linux-902eaef7781cef521dba7e0299b24e5f4b78b688.tar.xz
kernel-qcow2-linux-902eaef7781cef521dba7e0299b24e5f4b78b688.zip
arm64: kaslr: Reserve size of ARM64_MEMSTART_ALIGN in linear region
[ Upstream commit c8a43c18a97845e7f94ed7d181c11f41964976a2 ] When KASLR is enabled (CONFIG_RANDOMIZE_BASE=y), the top 4K of kernel virtual address space may be mapped to physical addresses despite being reserved for ERR_PTR values. Fix the randomization of the linear region so that we avoid mapping the last page of the virtual address space. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: liyueyi <liyueyi@live.com> [will: rewrote commit message; merged in suggestion from Ard] Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
-rw-r--r--arch/arm64/mm/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 787e27964ab9..774c3e17c798 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -450,7 +450,7 @@ void __init arm64_memblock_init(void)
* memory spans, randomize the linear region as well.
*/
if (memstart_offset_seed > 0 && range >= ARM64_MEMSTART_ALIGN) {
- range = range / ARM64_MEMSTART_ALIGN + 1;
+ range /= ARM64_MEMSTART_ALIGN;
memstart_addr -= ARM64_MEMSTART_ALIGN *
((range * memstart_offset_seed) >> 16);
}