]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/arm64/kernel/kaslr.c
Merge tag 'for-linus-20170825' of git://git.infradead.org/linux-mtd
[mirror_ubuntu-artful-kernel.git] / arch / arm64 / kernel / kaslr.c
index 1d95c204186b40f8e8225fd1885136db0dd0928b..47080c49cc7e77a3df120f061f7b10f90a8c2ec5 100644 (file)
@@ -131,8 +131,7 @@ u64 __init kaslr_early_init(u64 dt_phys)
        /*
         * 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
-        * rounded up by SWAPPER_BLOCK_SIZE.
+        * happens, round down the KASLR offset by (1 << SWAPPER_TABLE_SHIFT).
         *
         * NOTE: The references to _text and _end below will already take the
         *       modulo offset (the physical displacement modulo 2 MB) into
@@ -141,11 +140,8 @@ u64 __init kaslr_early_init(u64 dt_phys)
         *       mapping we choose.
         */
        if ((((u64)_text + offset) >> SWAPPER_TABLE_SHIFT) !=
-           (((u64)_end + offset) >> SWAPPER_TABLE_SHIFT)) {
-               u64 kimg_sz = _end - _text;
-               offset = (offset + round_up(kimg_sz, SWAPPER_BLOCK_SIZE))
-                               & mask;
-       }
+           (((u64)_end + offset) >> SWAPPER_TABLE_SHIFT))
+               offset = round_down(offset, 1 << SWAPPER_TABLE_SHIFT);
 
        if (IS_ENABLED(CONFIG_KASAN))
                /*