diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-01-19 22:27:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-01-19 22:27:59 -0500 |
commit | b0f3e768a89bbc72195023c3db1db45c40e5b70c (patch) | |
tree | a83f1ffb13e7de39fa9efea135bc44eb26ef635c | |
parent | 5d5c303ea095bdd3a2b073075920bf159457069a (diff) | |
parent | 7fa1e2e6afa7f4c9f46528e61de6a15d9e8dffd9 (diff) |
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon:
"Three arm64 fixes for -rc3.
We've plugged a couple of nasty issues involving KASLR-enabled
kernels, and removed a redundant #define that was introduced as part
of the KHWASAN fixes from akpm at -rc2.
- Fix broken kpti page-table rewrite in bizarre KASLR configuration
- Fix module loading with KASLR
- Remove redundant definition of ARCH_SLAB_MINALIGN"
* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
kasan, arm64: remove redundant ARCH_SLAB_MINALIGN define
arm64: kaslr: ensure randomized quantities are clean to the PoC
arm64: kpti: Update arm64_kernel_use_ng_mappings() when forced on
-rw-r--r-- | arch/arm64/include/asm/cache.h | 2 | ||||
-rw-r--r-- | arch/arm64/include/asm/mmu.h | 5 | ||||
-rw-r--r-- | arch/arm64/kernel/kaslr.c | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index eb43e09c1980..926434f413fa 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h | |||
@@ -60,8 +60,6 @@ | |||
60 | 60 | ||
61 | #ifdef CONFIG_KASAN_SW_TAGS | 61 | #ifdef CONFIG_KASAN_SW_TAGS |
62 | #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) | 62 | #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) |
63 | #else | ||
64 | #define ARCH_SLAB_MINALIGN __alignof__(unsigned long long) | ||
65 | #endif | 63 | #endif |
66 | 64 | ||
67 | #ifndef __ASSEMBLY__ | 65 | #ifndef __ASSEMBLY__ |
diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index ac352accb3d9..3e8063f4f9d3 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h | |||
@@ -60,8 +60,11 @@ static inline bool arm64_kernel_use_ng_mappings(void) | |||
60 | * later determine that kpti is required, then | 60 | * later determine that kpti is required, then |
61 | * kpti_install_ng_mappings() will make them non-global. | 61 | * kpti_install_ng_mappings() will make them non-global. |
62 | */ | 62 | */ |
63 | if (arm64_kernel_unmapped_at_el0()) | ||
64 | return true; | ||
65 | |||
63 | if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE)) | 66 | if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE)) |
64 | return arm64_kernel_unmapped_at_el0(); | 67 | return false; |
65 | 68 | ||
66 | /* | 69 | /* |
67 | * KASLR is enabled so we're going to be enabling kpti on non-broken | 70 | * KASLR is enabled so we're going to be enabling kpti on non-broken |
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c index f0e6ab8abe9c..ba6b41790fcd 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 | ||
@@ -109,7 +110,7 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
109 | * Check if 'nokaslr' appears on the command line, and | 110 | * Check if 'nokaslr' appears on the command line, and |
110 | * return 0 if that is the case. | 111 | * return 0 if that is the case. |
111 | */ | 112 | */ |
112 | cmdline = get_cmdline(fdt); | 113 | cmdline = kaslr_get_cmdline(fdt); |
113 | str = strstr(cmdline, "nokaslr"); | 114 | str = strstr(cmdline, "nokaslr"); |
114 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) | 115 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) |
115 | return 0; | 116 | return 0; |
@@ -169,5 +170,8 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
169 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; | 170 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; |
170 | module_alloc_base &= PAGE_MASK; | 171 | module_alloc_base &= PAGE_MASK; |
171 | 172 | ||
173 | __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | ||
174 | __flush_dcache_area(&memstart_offset_seed, sizeof(memstart_offset_seed)); | ||
175 | |||
172 | return offset; | 176 | return offset; |
173 | } | 177 | } |