aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/kernel/kaslr.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index 1d95c204186b..47080c49cc7e 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -131,8 +131,7 @@ u64 __init kaslr_early_init(u64 dt_phys)
131 /* 131 /*
132 * The kernel Image should not extend across a 1GB/32MB/512MB alignment 132 * The kernel Image should not extend across a 1GB/32MB/512MB alignment
133 * boundary (for 4KB/16KB/64KB granule kernels, respectively). If this 133 * boundary (for 4KB/16KB/64KB granule kernels, respectively). If this
134 * happens, increase the KASLR offset by the size of the kernel image 134 * happens, round down the KASLR offset by (1 << SWAPPER_TABLE_SHIFT).
135 * rounded up by SWAPPER_BLOCK_SIZE.
136 * 135 *
137 * NOTE: The references to _text and _end below will already take the 136 * NOTE: The references to _text and _end below will already take the
138 * modulo offset (the physical displacement modulo 2 MB) into 137 * modulo offset (the physical displacement modulo 2 MB) into
@@ -141,11 +140,8 @@ u64 __init kaslr_early_init(u64 dt_phys)
141 * mapping we choose. 140 * mapping we choose.
142 */ 141 */
143 if ((((u64)_text + offset) >> SWAPPER_TABLE_SHIFT) != 142 if ((((u64)_text + offset) >> SWAPPER_TABLE_SHIFT) !=
144 (((u64)_end + offset) >> SWAPPER_TABLE_SHIFT)) { 143 (((u64)_end + offset) >> SWAPPER_TABLE_SHIFT))
145 u64 kimg_sz = _end - _text; 144 offset = round_down(offset, 1 << SWAPPER_TABLE_SHIFT);
146 offset = (offset + round_up(kimg_sz, SWAPPER_BLOCK_SIZE))
147 & mask;
148 }
149 145
150 if (IS_ENABLED(CONFIG_KASAN)) 146 if (IS_ENABLED(CONFIG_KASAN))
151 /* 147 /*