mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 23:25:07 +00:00
arm64: kaslr: Reserve size of ARM64_MEMSTART_ALIGN in linear region
[ Upstream commit c8a43c18a9
]
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>
This commit is contained in:
parent
83b4ccf2ae
commit
8add705407
1 changed files with 1 additions and 1 deletions
|
@ -447,7 +447,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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue