arm64: kaslr: Adjust the offset to avoid Image across alignment boundary
authorCatalin Marinas <[email protected]>
Tue, 22 Aug 2017 14:39:00 +0000 (15:39 +0100)
committerWill Deacon <[email protected]>
Tue, 22 Aug 2017 17:15:42 +0000 (18:15 +0100)
commita067d94d37ed590fd17684d18c3edf52110d305a
treea9a77b734e1d41672784140020add86574b48e08
parent4a23e56ad6549d0b8c0fac6d9eb752884379c391
arm64: kaslr: Adjust the offset to avoid Image across alignment boundary

With 16KB pages and a kernel Image larger than 16MB, the current
kaslr_early_init() logic for avoiding mappings across swapper table
boundaries fails since increasing the offset by kimg_sz just moves the
problem to the next boundary.

This patch rounds the offset down to (1 << SWAPPER_TABLE_SHIFT) if the
Image crosses a PMD_SIZE boundary.

Fixes: afd0e5a87670 ("arm64: kaslr: Fix up the kernel image alignment")
Cc: Ard Biesheuvel <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Neeraj Upadhyay <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
arch/arm64/kernel/kaslr.c