arm64/kasan: don't allocate extra shadow memory
authorAndrey Ryabinin <[email protected]>
Mon, 10 Jul 2017 22:50:31 +0000 (15:50 -0700)
committerLinus Torvalds <[email protected]>
Mon, 10 Jul 2017 23:32:33 +0000 (16:32 -0700)
We used to read several bytes of the shadow memory in advance.
Therefore additional shadow memory mapped to prevent crash if
speculative load would happen near the end of the mapped shadow memory.

Now we don't have such speculative loads, so we no longer need to map
additional shadow memory.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andrey Ryabinin <[email protected]>
Acked-by: Mark Rutland <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/arm64/mm/kasan_init.c

index 687a358a37337af9cf7a0d50c27b0176cfbd2012..81f03959a4ab2f1729718fa6a528d751d0495482 100644 (file)
@@ -191,14 +191,8 @@ void __init kasan_init(void)
                if (start >= end)
                        break;
 
-               /*
-                * end + 1 here is intentional. We check several shadow bytes in
-                * advance to slightly speed up fastpath. In some rare cases
-                * we could cross boundary of mapped shadow, so we just map
-                * some more here.
-                */
                vmemmap_populate((unsigned long)kasan_mem_to_shadow(start),
-                               (unsigned long)kasan_mem_to_shadow(end) + 1,
+                               (unsigned long)kasan_mem_to_shadow(end),
                                pfn_to_nid(virt_to_pfn(start)));
        }