]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: kaslr: ignore modulo offset when validating virtual displacement
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 18 Aug 2017 17:42:30 +0000 (18:42 +0100)
committerWill Deacon <will.deacon@arm.com>
Tue, 22 Aug 2017 17:15:42 +0000 (18:15 +0100)
commit715be18d74344d9029cf020daad50c1b6a264300
treebe09ef1ef45c2eeede655b2b5f51623e99910cc7
parentbec102b4dc994f836b479b337d78026c7ec26117
arm64: kaslr: ignore modulo offset when validating virtual displacement

In the KASLR setup routine, we ensure that the early virtual mapping
of the kernel image does not cover more than a single table entry at
the level above the swapper block level, so that the assembler routines
involved in setting up this mapping can remain simple.

In this calculation we add the proposed KASLR offset to the values of
the _text and _end markers, and reject it if they would end up falling
in different swapper table sized windows.

However, when taking the addresses of _text and _end, the modulo offset
(the physical displacement modulo 2 MB) is already accounted for, and
so adding it again results in incorrect results. So disregard the modulo
offset from the calculation.

Fixes: 3dafa8de0a4f ("arm64: relocatable: deal with physically misaligned ...")
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/head.S
arch/arm64/kernel/kaslr.c