summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-03-24 12:12:50 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-03-24 12:12:49 -0700
commitef1e7d218cf7aebbca14654419a1f9b57248bf46 (patch)
treeffa2842e4c45f7e7819e077fe12123799397e9c5 /arch
parent0c422cda970b2583b0523d61f8c1596d21d219b5 (diff)
parentff0f90c107bdde8a0c9333379f3ff1662089e91f (diff)
Merge "arm64: kaslr: Fix up the kernel image alignment"
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/kernel/kaslr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index b05469173ba5..310f2f463cd4 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -130,11 +130,15 @@ u64 __init kaslr_early_init(u64 dt_phys, u64 modulo_offset)
/*
* The kernel Image should not extend across a 1GB/32MB/512MB alignment
* boundary (for 4KB/16KB/64KB granule kernels, respectively). If this
- * happens, increase the KASLR offset by the size of the kernel image.
+ * happens, increase the KASLR offset by the size of the kernel image
+ * rounded up by SWAPPER_BLOCK_SIZE.
*/
if ((((u64)_text + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT) !=
- (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT))
- offset = (offset + (u64)(_end - _text)) & mask;
+ (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT)) {
+ u64 kimg_sz = _end - _text;
+ offset = (offset + round_up(kimg_sz, SWAPPER_BLOCK_SIZE))
+ & mask;
+ }
if (IS_ENABLED(CONFIG_KASAN))
/*