aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/mm/init.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-02-16 07:52:40 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2016-02-18 13:16:44 -0500
commitf9040773b7bbbd9e98eb6184a263512a7cfc133f (patch)
tree8af5e77510e3774356f737a8674954e776001e93 /arch/arm64/mm/init.c
parenta0bf9776cd0be4490d4675d4108e13379849fc7f (diff)
arm64: move kernel image to base of vmalloc area
This moves the module area to right before the vmalloc area, and moves the kernel image to the base of the vmalloc area. This is an intermediate step towards implementing KASLR, which allows the kernel image to be located anywhere in the vmalloc area. Since other subsystems such as hibernate may still need to refer to the kernel text or data segments via their linears addresses, both are mapped in the linear region as well. The linear alias of the text region is mapped read-only/non-executable to prevent inadvertent modification or execution. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm/init.c')
-rw-r--r--arch/arm64/mm/init.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index f3b061e67bfe..1d627cd8121c 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -36,6 +36,7 @@
36#include <linux/swiotlb.h> 36#include <linux/swiotlb.h>
37 37
38#include <asm/fixmap.h> 38#include <asm/fixmap.h>
39#include <asm/kasan.h>
39#include <asm/memory.h> 40#include <asm/memory.h>
40#include <asm/sections.h> 41#include <asm/sections.h>
41#include <asm/setup.h> 42#include <asm/setup.h>
@@ -302,22 +303,26 @@ void __init mem_init(void)
302#ifdef CONFIG_KASAN 303#ifdef CONFIG_KASAN
303 " kasan : 0x%16lx - 0x%16lx (%6ld GB)\n" 304 " kasan : 0x%16lx - 0x%16lx (%6ld GB)\n"
304#endif 305#endif
306 " modules : 0x%16lx - 0x%16lx (%6ld MB)\n"
305 " vmalloc : 0x%16lx - 0x%16lx (%6ld GB)\n" 307 " vmalloc : 0x%16lx - 0x%16lx (%6ld GB)\n"
308 " .init : 0x%p" " - 0x%p" " (%6ld KB)\n"
309 " .text : 0x%p" " - 0x%p" " (%6ld KB)\n"
310 " .data : 0x%p" " - 0x%p" " (%6ld KB)\n"
306#ifdef CONFIG_SPARSEMEM_VMEMMAP 311#ifdef CONFIG_SPARSEMEM_VMEMMAP
307 " vmemmap : 0x%16lx - 0x%16lx (%6ld GB maximum)\n" 312 " vmemmap : 0x%16lx - 0x%16lx (%6ld GB maximum)\n"
308 " 0x%16lx - 0x%16lx (%6ld MB actual)\n" 313 " 0x%16lx - 0x%16lx (%6ld MB actual)\n"
309#endif 314#endif
310 " fixed : 0x%16lx - 0x%16lx (%6ld KB)\n" 315 " fixed : 0x%16lx - 0x%16lx (%6ld KB)\n"
311 " PCI I/O : 0x%16lx - 0x%16lx (%6ld MB)\n" 316 " PCI I/O : 0x%16lx - 0x%16lx (%6ld MB)\n"
312 " modules : 0x%16lx - 0x%16lx (%6ld MB)\n" 317 " memory : 0x%16lx - 0x%16lx (%6ld MB)\n",
313 " memory : 0x%16lx - 0x%16lx (%6ld MB)\n"
314 " .init : 0x%p" " - 0x%p" " (%6ld KB)\n"
315 " .text : 0x%p" " - 0x%p" " (%6ld KB)\n"
316 " .data : 0x%p" " - 0x%p" " (%6ld KB)\n",
317#ifdef CONFIG_KASAN 318#ifdef CONFIG_KASAN
318 MLG(KASAN_SHADOW_START, KASAN_SHADOW_END), 319 MLG(KASAN_SHADOW_START, KASAN_SHADOW_END),
319#endif 320#endif
321 MLM(MODULES_VADDR, MODULES_END),
320 MLG(VMALLOC_START, VMALLOC_END), 322 MLG(VMALLOC_START, VMALLOC_END),
323 MLK_ROUNDUP(__init_begin, __init_end),
324 MLK_ROUNDUP(_text, _etext),
325 MLK_ROUNDUP(_sdata, _edata),
321#ifdef CONFIG_SPARSEMEM_VMEMMAP 326#ifdef CONFIG_SPARSEMEM_VMEMMAP
322 MLG((unsigned long)vmemmap, 327 MLG((unsigned long)vmemmap,
323 (unsigned long)vmemmap + VMEMMAP_SIZE), 328 (unsigned long)vmemmap + VMEMMAP_SIZE),
@@ -326,11 +331,7 @@ void __init mem_init(void)
326#endif 331#endif
327 MLK(FIXADDR_START, FIXADDR_TOP), 332 MLK(FIXADDR_START, FIXADDR_TOP),
328 MLM(PCI_IO_START, PCI_IO_END), 333 MLM(PCI_IO_START, PCI_IO_END),
329 MLM(MODULES_VADDR, MODULES_END), 334 MLM(PAGE_OFFSET, (unsigned long)high_memory));
330 MLM(PAGE_OFFSET, (unsigned long)high_memory),
331 MLK_ROUNDUP(__init_begin, __init_end),
332 MLK_ROUNDUP(_text, _etext),
333 MLK_ROUNDUP(_sdata, _edata));
334 335
335#undef MLK 336#undef MLK
336#undef MLM 337#undef MLM
@@ -358,8 +359,8 @@ void __init mem_init(void)
358 359
359void free_initmem(void) 360void free_initmem(void)
360{ 361{
361 fixup_init();
362 free_initmem_default(0); 362 free_initmem_default(0);
363 fixup_init();
363} 364}
364 365
365#ifdef CONFIG_BLK_DEV_INITRD 366#ifdef CONFIG_BLK_DEV_INITRD