diff options
-rw-r--r-- | gcc10.patch | 87 | ||||
-rw-r--r-- | stackcanary.patch | 65 |
2 files changed, 0 insertions, 152 deletions
diff --git a/gcc10.patch b/gcc10.patch deleted file mode 100644 index cad51f61e1b9..000000000000 --- a/gcc10.patch +++ /dev/null @@ -1,87 +0,0 @@ -commit 3a58245198d7ea9521e1a856111df27f22822cb6 -Author: egnappahz <egnappah@gmail.com> -Date: Fri May 15 12:21:43 2020 +0200 - - disable warning as errors for gcc10 - - Signed-off-by: egnappahz <egnappah@gmail.com> - -diff --git a/Makefile b/Makefile -index d252219666fd..d4938ac6ebbf 100644 ---- a/Makefile -+++ b/Makefile -@@ -708,10 +708,6 @@ else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE - KBUILD_CFLAGS += -Os - endif - --ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED --KBUILD_CFLAGS += -Wno-maybe-uninitialized --endif -- - # Tell gcc to never replace conditional load with a non-conditional one - KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) - -@@ -861,6 +857,9 @@ KBUILD_CFLAGS += -Wno-pointer-sign - # disable stringop warnings in gcc 8+ - KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) - -+# Enabled with W=2, disabled by default as noisy -+KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized) -+ - # disable invalid "can't wrap" optimizations for signed / pointers - KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) - -diff --git a/init/Kconfig b/init/Kconfig -index 4f717bfdbfe2..ef59c5c36cdb 100644 ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -36,22 +36,6 @@ config TOOLS_SUPPORT_RELR - config CC_HAS_ASM_INLINE - def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null) - --config CC_HAS_WARN_MAYBE_UNINITIALIZED -- def_bool $(cc-option,-Wmaybe-uninitialized) -- help -- GCC >= 4.7 supports this option. -- --config CC_DISABLE_WARN_MAYBE_UNINITIALIZED -- bool -- depends on CC_HAS_WARN_MAYBE_UNINITIALIZED -- default CC_IS_GCC && GCC_VERSION < 40900 # unreliable for GCC < 4.9 -- help -- GCC's -Wmaybe-uninitialized is not reliable by definition. -- Lots of false positive warnings are produced in some cases. -- -- If this option is enabled, -Wno-maybe-uninitialzed is passed -- to the compiler to suppress maybe-uninitialized warnings. -- - config CONSTRUCTORS - bool - depends on !UML -@@ -1249,14 +1233,12 @@ config CC_OPTIMIZE_FOR_PERFORMANCE - config CC_OPTIMIZE_FOR_PERFORMANCE_O3 - bool "Optimize more for performance (-O3)" - depends on ARC -- imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives - help - Choosing this option will pass "-O3" to your compiler to optimize - the kernel yet more for performance. - - config CC_OPTIMIZE_FOR_SIZE - bool "Optimize for size (-Os)" -- imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives - help - Choosing this option will pass "-Os" to your compiler resulting - in a smaller kernel. -diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig -index 402eef84c859..743647005f64 100644 ---- a/kernel/trace/Kconfig -+++ b/kernel/trace/Kconfig -@@ -466,7 +466,6 @@ config PROFILE_ANNOTATED_BRANCHES - config PROFILE_ALL_BRANCHES - bool "Profile all if conditionals" if !FORTIFY_SOURCE - select TRACE_BRANCH_PROFILING -- imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives - help - This tracer profiles all branch conditions. Every if () - taken in the kernel is recorded whether it hit or miss. diff --git a/stackcanary.patch b/stackcanary.patch deleted file mode 100644 index 50e58c8cb371..000000000000 --- a/stackcanary.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h -index 91e29b6a86a5..9804a7957f4e 100644 ---- a/arch/x86/include/asm/stackprotector.h -+++ b/arch/x86/include/asm/stackprotector.h -@@ -55,8 +55,13 @@ - /* - * Initialize the stackprotector canary value. - * -- * NOTE: this must only be called from functions that never return, -+ * NOTE: this must only be called from functions that never return - * and it must always be inlined. -+ * -+ * In addition, it should be called from a compilation unit for which -+ * stack protector is disabled. Alternatively, the caller should not end -+ * with a function call which gets tail-call optimized as that would -+ * lead to checking a modified canary value. - */ - static __always_inline void boot_init_stack_canary(void) - { -diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c -index 69881b2d446c..9674321ce3a3 100644 ---- a/arch/x86/kernel/smpboot.c -+++ b/arch/x86/kernel/smpboot.c -@@ -262,6 +262,14 @@ static void notrace start_secondary(void *unused) - - wmb(); - cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); -+ -+ /* -+ * Prevent tail call to cpu_startup_entry() because the stack protector -+ * guard has been changed a couple of function calls up, in -+ * boot_init_stack_canary() and must not be checked before tail calling -+ * another function. -+ */ -+ prevent_tail_call_optimization(); - } - - /** -diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c -index 802ee5bba66c..0cebe5db691d 100644 ---- a/arch/x86/xen/smp_pv.c -+++ b/arch/x86/xen/smp_pv.c -@@ -92,6 +92,7 @@ asmlinkage __visible void cpu_bringup_and_idle(void) - cpu_bringup(); - boot_init_stack_canary(); - cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); -+ prevent_tail_call_optimization(); - } - - void xen_smp_intr_free_pv(unsigned int cpu) -diff --git a/include/linux/compiler.h b/include/linux/compiler.h -index 034b0a644efc..732754d96039 100644 ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -356,4 +356,10 @@ static inline void *offset_to_ptr(const int *off) - /* &a[0] degrades to a pointer: a different type from an array */ - #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) - -+/* -+ * This is needed in functions which generate the stack canary, see -+ * arch/x86/kernel/smpboot.c::start_secondary() for an example. -+ */ -+#define prevent_tail_call_optimization() asm("") -+ - #endif /* __LINUX_COMPILER_H */ |