diff options
author | Yueyi Li <liyueyi@live.com> | 2018-12-24 07:40:07 +0000 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2019-01-03 18:03:54 +0000 |
commit | c8a43c18a97845e7f94ed7d181c11f41964976a2 (patch) | |
tree | 14356b37f98932e6fe44a0befaa184d1734442be /arch/arm64/mm/init.c | |
parent | acafce48b07bf5f9994a38e7fe237193d43d092e (diff) | |
download | linux-c8a43c18a97845e7f94ed7d181c11f41964976a2.tar.gz linux-c8a43c18a97845e7f94ed7d181c11f41964976a2.tar.bz2 linux-c8a43c18a97845e7f94ed7d181c11f41964976a2.zip |
arm64: kaslr: Reserve size of ARM64_MEMSTART_ALIGN in linear region
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>
Diffstat (limited to 'arch/arm64/mm/init.c')
-rw-r--r-- | arch/arm64/mm/init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 4bfe0fc9edac..124be28e4e16 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -457,7 +457,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); } |