diff options
Diffstat (limited to 'arch/arm64/kernel/kaslr.c')
| -rw-r--r-- | arch/arm64/kernel/kaslr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c index f0e6ab8abe9c..b09b6f75f759 100644 --- a/arch/arm64/kernel/kaslr.c +++ b/arch/arm64/kernel/kaslr.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 16 | 16 | ||
| 17 | #include <asm/cacheflush.h> | ||
| 17 | #include <asm/fixmap.h> | 18 | #include <asm/fixmap.h> |
| 18 | #include <asm/kernel-pgtable.h> | 19 | #include <asm/kernel-pgtable.h> |
| 19 | #include <asm/memory.h> | 20 | #include <asm/memory.h> |
| @@ -43,7 +44,7 @@ static __init u64 get_kaslr_seed(void *fdt) | |||
| 43 | return ret; | 44 | return ret; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | static __init const u8 *get_cmdline(void *fdt) | 47 | static __init const u8 *kaslr_get_cmdline(void *fdt) |
| 47 | { | 48 | { |
| 48 | static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE; | 49 | static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE; |
| 49 | 50 | ||
| @@ -87,6 +88,7 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
| 87 | * we end up running with module randomization disabled. | 88 | * we end up running with module randomization disabled. |
| 88 | */ | 89 | */ |
| 89 | module_alloc_base = (u64)_etext - MODULES_VSIZE; | 90 | module_alloc_base = (u64)_etext - MODULES_VSIZE; |
| 91 | __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | ||
| 90 | 92 | ||
| 91 | /* | 93 | /* |
| 92 | * Try to map the FDT early. If this fails, we simply bail, | 94 | * Try to map the FDT early. If this fails, we simply bail, |
| @@ -109,7 +111,7 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
| 109 | * Check if 'nokaslr' appears on the command line, and | 111 | * Check if 'nokaslr' appears on the command line, and |
| 110 | * return 0 if that is the case. | 112 | * return 0 if that is the case. |
| 111 | */ | 113 | */ |
| 112 | cmdline = get_cmdline(fdt); | 114 | cmdline = kaslr_get_cmdline(fdt); |
| 113 | str = strstr(cmdline, "nokaslr"); | 115 | str = strstr(cmdline, "nokaslr"); |
| 114 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) | 116 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) |
| 115 | return 0; | 117 | return 0; |
| @@ -169,5 +171,8 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
| 169 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; | 171 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; |
| 170 | module_alloc_base &= PAGE_MASK; | 172 | module_alloc_base &= PAGE_MASK; |
| 171 | 173 | ||
| 174 | __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | ||
| 175 | __flush_dcache_area(&memstart_offset_seed, sizeof(memstart_offset_seed)); | ||
| 176 | |||
| 172 | return offset; | 177 | return offset; |
| 173 | } | 178 | } |
