x86/32: Remove CONFIG_DOUBLEFAULT
authorBorislav Petkov <bp@suse.de>
Fri, 3 Apr 2020 23:33:05 +0000 (01:33 +0200)
committerBorislav Petkov <bp@suse.de>
Tue, 14 Apr 2020 12:24:05 +0000 (14:24 +0200)
Make the doublefault exception handler unconditional on 32-bit. Yes,
it is important to be able to catch #DF exceptions instead of silent
reboots. Yes, the code size increase is worth every byte. And one less
CONFIG symbol is just the cherry on top.

No functional changes.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200404083646.8897-1-bp@alien8.de
arch/x86/Kconfig.debug
arch/x86/entry/entry_32.S
arch/x86/include/asm/doublefault.h
arch/x86/include/asm/traps.h
arch/x86/kernel/Makefile
arch/x86/kernel/dumpstack_32.c
arch/x86/kernel/traps.c
arch/x86/mm/cpu_entry_area.c
tools/testing/selftests/wireguard/qemu/debug.config

index 2e74690b028a5b93306f689b9cd9ef8f82649e5c..f909d3ce36e6e289d8077715b18cc63de9a45f56 100644 (file)
@@ -99,15 +99,6 @@ config DEBUG_WX
 
          If in doubt, say "Y".
 
-config DOUBLEFAULT
-       default y
-       bool "Enable doublefault exception handler" if EXPERT && X86_32
-       ---help---
-         This option allows trapping of rare doublefault exceptions that
-         would otherwise cause a system to silently reboot. Disabling this
-         option saves about 4k and might cause you much additional grey
-         hair.
-
 config DEBUG_TLBFLUSH
        bool "Set upper limit of TLB entries to flush one-by-one"
        depends on DEBUG_KERNEL
index b67bae7091d7ecf9d5319b976c10be5e6045caa2..5c9c7eee63254fd4718194dbe39bdd6a5792ce50 100644 (file)
@@ -1536,7 +1536,6 @@ SYM_CODE_START(debug)
        jmp     common_exception
 SYM_CODE_END(debug)
 
-#ifdef CONFIG_DOUBLEFAULT
 SYM_CODE_START(double_fault)
 1:
        /*
@@ -1576,7 +1575,6 @@ SYM_CODE_START(double_fault)
        hlt
        jmp 1b
 SYM_CODE_END(double_fault)
-#endif
 
 /*
  * NMI is doubly nasty.  It can happen on the first instruction of
index af9a14ac896262a097707757e616b45c94ebc74a..54a6e4a2e132d1b9527a90793ba60ece450be07c 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef _ASM_X86_DOUBLEFAULT_H
 #define _ASM_X86_DOUBLEFAULT_H
 
-#if defined(CONFIG_X86_32) && defined(CONFIG_DOUBLEFAULT)
+#ifdef CONFIG_X86_32
 extern void doublefault_init_cpu_tss(void);
 #else
 static inline void doublefault_init_cpu_tss(void)
index c26a7e1d8a2c491ca6f004a716031393a5f35ece..70bd0f356e5d55b23e1700ddbc5b74f4b8a4e97b 100644 (file)
@@ -69,9 +69,7 @@ dotraplinkage void do_overflow(struct pt_regs *regs, long error_code);
 dotraplinkage void do_bounds(struct pt_regs *regs, long error_code);
 dotraplinkage void do_invalid_op(struct pt_regs *regs, long error_code);
 dotraplinkage void do_device_not_available(struct pt_regs *regs, long error_code);
-#if defined(CONFIG_X86_64) || defined(CONFIG_DOUBLEFAULT)
 dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code, unsigned long cr2);
-#endif
 dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *regs, long error_code);
 dotraplinkage void do_invalid_TSS(struct pt_regs *regs, long error_code);
 dotraplinkage void do_segment_not_present(struct pt_regs *regs, long error_code);
index ba89cabe5fcf1136cb42d9cb6fa24c75e401bd0c..2a7c3afa62e2ef308fdb1294395c31efb11cc3a1 100644 (file)
@@ -102,9 +102,7 @@ obj-$(CONFIG_KEXEC_FILE)    += kexec-bzimage64.o
 obj-$(CONFIG_CRASH_DUMP)       += crash_dump_$(BITS).o
 obj-y                          += kprobes/
 obj-$(CONFIG_MODULES)          += module.o
-ifeq ($(CONFIG_X86_32),y)
-obj-$(CONFIG_DOUBLEFAULT)      += doublefault_32.o
-endif
+obj-$(CONFIG_X86_32)           += doublefault_32.o
 obj-$(CONFIG_KGDB)             += kgdb.o
 obj-$(CONFIG_VM86)             += vm86_32.o
 obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
index 8e3a8fedfa4d705086376671d63d081898df971c..722fd712e1cf029adff9a73c73aad44992dbcef6 100644 (file)
@@ -87,7 +87,6 @@ static bool in_softirq_stack(unsigned long *stack, struct stack_info *info)
 
 static bool in_doublefault_stack(unsigned long *stack, struct stack_info *info)
 {
-#ifdef CONFIG_DOUBLEFAULT
        struct cpu_entry_area *cea = get_cpu_entry_area(raw_smp_processor_id());
        struct doublefault_stack *ss = &cea->doublefault_stack;
 
@@ -103,9 +102,6 @@ static bool in_doublefault_stack(unsigned long *stack, struct stack_info *info)
        info->next_sp   = (unsigned long *)this_cpu_read(cpu_tss_rw.x86_tss.sp);
 
        return true;
-#else
-       return false;
-#endif
 }
 
 
index d54cffdc7cac2b5c55b272c7df3a8756fbd024c1..e85561fc0dc8905fccba36b4bbbfccad153dfc3e 100644 (file)
@@ -326,7 +326,6 @@ __visible void __noreturn handle_stack_overflow(const char *message,
 }
 #endif
 
-#if defined(CONFIG_X86_64) || defined(CONFIG_DOUBLEFAULT)
 /*
  * Runs on an IST stack for x86_64 and on a special task stack for x86_32.
  *
@@ -450,7 +449,6 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code, unsign
        die("double fault", regs, error_code);
        panic("Machine halted.");
 }
-#endif
 
 dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
 {
index 56f9189bbadb4700973d3ff1b1be85c710ffd463..5199d8a1daf1f0ce3a82c6e301eba7efad25737c 100644 (file)
@@ -17,7 +17,7 @@ static DEFINE_PER_CPU_PAGE_ALIGNED(struct exception_stacks, exception_stacks);
 DEFINE_PER_CPU(struct cea_exception_stacks*, cea_exception_stacks);
 #endif
 
-#if defined(CONFIG_X86_32) && defined(CONFIG_DOUBLEFAULT)
+#ifdef CONFIG_X86_32
 DECLARE_PER_CPU_PAGE_ALIGNED(struct doublefault_stack, doublefault_stack);
 #endif
 
@@ -114,12 +114,10 @@ static void __init percpu_setup_exception_stacks(unsigned int cpu)
 #else
 static inline void percpu_setup_exception_stacks(unsigned int cpu)
 {
-#ifdef CONFIG_DOUBLEFAULT
        struct cpu_entry_area *cea = get_cpu_entry_area(cpu);
 
        cea_map_percpu_pages(&cea->doublefault_stack,
                             &per_cpu(doublefault_stack, cpu), 1, PAGE_KERNEL);
-#endif
 }
 #endif
 
index 5909e7ef2a5c5c1a30b40e4c7d58ff585335e756..807fa7dc60b86ece6ab59647167b35cc5b23a122 100644 (file)
@@ -58,7 +58,6 @@ CONFIG_RCU_EQS_DEBUG=y
 CONFIG_USER_STACKTRACE_SUPPORT=y
 CONFIG_DEBUG_SG=y
 CONFIG_DEBUG_NOTIFIERS=y
-CONFIG_DOUBLEFAULT=y
 CONFIG_X86_DEBUG_FPU=y
 CONFIG_DEBUG_SECTION_MISMATCH=y
 CONFIG_DEBUG_PAGEALLOC=y