aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-06-18 05:49:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-06-18 05:49:12 -0400
commitedf9364d3f924aff6f77176b8e52a4b68e5c30d6 (patch)
tree5e412c4a86fab4420bf9affbf3cd19cfaecbe8a7
parent4f51d57f3ff0f30bd805ff5bd04587a6145e1f73 (diff)
parentd9ee35acfabbc909c3be4360cd5655a006628b2e (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner: "Two fixlets for x86: - Handle WARN_ONs proper with the new UD based WARN implementation - Disable 1G mappings when 2M mappings are disabled by kmemleak or debug_pagealloc. Otherwise 1G mappings might still be used, confusing the debug mechanisms" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mm: Disable 1GB direct mappings when disabling 2MB mappings x86/debug: Handle early WARN_ONs proper
-rw-r--r--arch/x86/include/asm/extable.h1
-rw-r--r--arch/x86/kernel/traps.c2
-rw-r--r--arch/x86/mm/extable.c3
-rw-r--r--arch/x86/mm/init.c6
4 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/include/asm/extable.h b/arch/x86/include/asm/extable.h
index b8ad261d11dc..c66d19e3c23e 100644
--- a/arch/x86/include/asm/extable.h
+++ b/arch/x86/include/asm/extable.h
@@ -29,6 +29,7 @@ struct pt_regs;
29 } while (0) 29 } while (0)
30 30
31extern int fixup_exception(struct pt_regs *regs, int trapnr); 31extern int fixup_exception(struct pt_regs *regs, int trapnr);
32extern int fixup_bug(struct pt_regs *regs, int trapnr);
32extern bool ex_has_fault_handler(unsigned long ip); 33extern bool ex_has_fault_handler(unsigned long ip);
33extern void early_fixup_exception(struct pt_regs *regs, int trapnr); 34extern void early_fixup_exception(struct pt_regs *regs, int trapnr);
34 35
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 3995d3a777d4..bf54309b85da 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -182,7 +182,7 @@ int is_valid_bugaddr(unsigned long addr)
182 return ud == INSN_UD0 || ud == INSN_UD2; 182 return ud == INSN_UD0 || ud == INSN_UD2;
183} 183}
184 184
185static int fixup_bug(struct pt_regs *regs, int trapnr) 185int fixup_bug(struct pt_regs *regs, int trapnr)
186{ 186{
187 if (trapnr != X86_TRAP_UD) 187 if (trapnr != X86_TRAP_UD)
188 return 0; 188 return 0;
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c
index 35ea061010a1..0ea8afcb929c 100644
--- a/arch/x86/mm/extable.c
+++ b/arch/x86/mm/extable.c
@@ -162,6 +162,9 @@ void __init early_fixup_exception(struct pt_regs *regs, int trapnr)
162 if (fixup_exception(regs, trapnr)) 162 if (fixup_exception(regs, trapnr))
163 return; 163 return;
164 164
165 if (fixup_bug(regs, trapnr))
166 return;
167
165fail: 168fail:
166 early_printk("PANIC: early exception 0x%02x IP %lx:%lx error %lx cr2 0x%lx\n", 169 early_printk("PANIC: early exception 0x%02x IP %lx:%lx error %lx cr2 0x%lx\n",
167 (unsigned)trapnr, (unsigned long)regs->cs, regs->ip, 170 (unsigned)trapnr, (unsigned long)regs->cs, regs->ip,
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index cbc87ea98751..9b3f9fa5b283 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -161,16 +161,16 @@ static int page_size_mask;
161 161
162static void __init probe_page_size_mask(void) 162static void __init probe_page_size_mask(void)
163{ 163{
164#if !defined(CONFIG_KMEMCHECK)
165 /* 164 /*
166 * For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will 165 * For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will
167 * use small pages. 166 * use small pages.
168 * This will simplify cpa(), which otherwise needs to support splitting 167 * This will simplify cpa(), which otherwise needs to support splitting
169 * large pages into small in interrupt context, etc. 168 * large pages into small in interrupt context, etc.
170 */ 169 */
171 if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled()) 170 if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK))
172 page_size_mask |= 1 << PG_LEVEL_2M; 171 page_size_mask |= 1 << PG_LEVEL_2M;
173#endif 172 else
173 direct_gbpages = 0;
174 174
175 /* Enable PSE if available */ 175 /* Enable PSE if available */
176 if (boot_cpu_has(X86_FEATURE_PSE)) 176 if (boot_cpu_has(X86_FEATURE_PSE))