]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.7-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Sep 2016 09:48:20 +0000 (11:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Sep 2016 09:48:20 +0000 (11:48 +0200)
added patches:
disable-frame-address-warning.patch
disable-maybe-uninitialized-warning-globally.patch
makefile-mute-warning-for-__builtin_return_address-0-for-tracing-only.patch

queue-4.7/disable-frame-address-warning.patch [new file with mode: 0644]
queue-4.7/disable-maybe-uninitialized-warning-globally.patch [new file with mode: 0644]
queue-4.7/makefile-mute-warning-for-__builtin_return_address-0-for-tracing-only.patch [new file with mode: 0644]
queue-4.7/series

diff --git a/queue-4.7/disable-frame-address-warning.patch b/queue-4.7/disable-frame-address-warning.patch
new file mode 100644 (file)
index 0000000..5c13cec
--- /dev/null
@@ -0,0 +1,55 @@
+From 124a3d88fa20e1869fc229d7d8c740cc81944264 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Wed, 27 Jul 2016 19:03:04 -0700
+Subject: Disable "frame-address" warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 124a3d88fa20e1869fc229d7d8c740cc81944264 upstream.
+
+Newer versions of gcc warn about the use of __builtin_return_address()
+with a non-zero argument when "-Wall" is specified:
+
+  kernel/trace/trace_irqsoff.c: In function ‘stop_critical_timings’:
+  kernel/trace/trace_irqsoff.c:433:86: warning: calling ‘__builtin_return_address’ with a nonzero argument is unsafe [-Wframe-address]
+     stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
+  [ .. repeats a few times for other similar cases .. ]
+
+It is true that a non-zero argument is somewhat dangerous, and we do not
+actually have very many uses of that in the kernel - but the ftrace code
+does use it, and as Stephen Rostedt says:
+
+ "We are well aware of the danger of using __builtin_return_address() of
+  > 0.  In fact that's part of the reason for having the "thunk" code in
+  x86 (See arch/x86/entry/thunk_{64,32}.S).  [..] it adds extra frames
+  when tracking irqs off sections, to prevent __builtin_return_address()
+  from accessing bad areas.  In fact the thunk_32.S states: 'Trampoline to
+  trace irqs off.  (otherwise CALLER_ADDR1 might crash)'."
+
+For now, __builtin_return_address() with a non-zero argument is the best
+we can do, and the warning is not helpful and can end up making people
+miss other warnings for real problems.
+
+So disable the frame-address warning on compilers that need it.
+
+Acked-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/Makefile
++++ b/Makefile
+@@ -620,6 +620,7 @@ include arch/$(SRCARCH)/Makefile
+ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
+ KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
++KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
+ ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+ KBUILD_CFLAGS += -Os
diff --git a/queue-4.7/disable-maybe-uninitialized-warning-globally.patch b/queue-4.7/disable-maybe-uninitialized-warning-globally.patch
new file mode 100644 (file)
index 0000000..de0bee6
--- /dev/null
@@ -0,0 +1,85 @@
+From 6e8d666e925333c55378e8d5540a8a9ee0eea9c5 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Wed, 27 Jul 2016 13:17:41 -0700
+Subject: Disable "maybe-uninitialized" warning globally
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 6e8d666e925333c55378e8d5540a8a9ee0eea9c5 upstream.
+
+Several build configurations had already disabled this warning because
+it generates a lot of false positives.  But some had not, and it was
+still enabled for "allmodconfig" builds, for example.
+
+Looking at the warnings produced, every single one I looked at was a
+false positive, and the warnings are frequent enough (and big enough)
+that they can easily hide real problems that you don't notice in the
+noise generated by -Wmaybe-uninitialized.
+
+The warning is good in theory, but this is a classic case of a warning
+that causes more problems than the warning can solve.
+
+If gcc gets better at avoiding false positives, we may be able to
+re-enable this warning.  But as is, we're better off without it, and I
+want to be able to see the *real* warnings.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile               |    7 ++++---
+ arch/arc/Makefile      |    4 +---
+ scripts/Makefile.ubsan |    4 ----
+ 3 files changed, 5 insertions(+), 10 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -370,7 +370,7 @@ LDFLAGS_MODULE  =
+ CFLAGS_KERNEL =
+ AFLAGS_KERNEL =
+ LDFLAGS_vmlinux =
+-CFLAGS_GCOV   = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized
++CFLAGS_GCOV   = -fprofile-arcs -ftest-coverage -fno-tree-loop-im
+ CFLAGS_KCOV   = -fsanitize-coverage=trace-pc
+@@ -619,12 +619,13 @@ ARCH_CFLAGS :=
+ include arch/$(SRCARCH)/Makefile
+ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
++KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
+ ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+-KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
++KBUILD_CFLAGS += -Os
+ else
+ ifdef CONFIG_PROFILE_ALL_BRANCHES
+-KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
++KBUILD_CFLAGS += -O2
+ else
+ KBUILD_CFLAGS   += -O2
+ endif
+--- a/arch/arc/Makefile
++++ b/arch/arc/Makefile
+@@ -74,9 +74,7 @@ endif
+ ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
+ # Generic build system uses -O2, we want -O3
+ # Note: No need to add to cflags-y as that happens anyways
+-#
+-# Disable the false maybe-uninitialized warings gcc spits out at -O3
+-ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
++ARCH_CFLAGS += -O3
+ endif
+ # small data is default for elf32 tool-chain. If not usable, disable it
+--- a/scripts/Makefile.ubsan
++++ b/scripts/Makefile.ubsan
+@@ -14,8 +14,4 @@ ifdef CONFIG_UBSAN
+ ifdef CONFIG_UBSAN_ALIGNMENT
+       CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment)
+ endif
+-
+-      # -fsanitize=* options makes GCC less smart than usual and
+-      # increase number of 'maybe-uninitialized false-positives
+-      CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
+ endif
diff --git a/queue-4.7/makefile-mute-warning-for-__builtin_return_address-0-for-tracing-only.patch b/queue-4.7/makefile-mute-warning-for-__builtin_return_address-0-for-tracing-only.patch
new file mode 100644 (file)
index 0000000..490dd80
--- /dev/null
@@ -0,0 +1,60 @@
+From 377ccbb483738f84400ddf5840c7dd8825716985 Mon Sep 17 00:00:00 2001
+From: Steven Rostedt <rostedt@goodmis.org>
+Date: Thu, 28 Jul 2016 22:30:43 -0400
+Subject: Makefile: Mute warning for __builtin_return_address(>0) for tracing only
+
+From: Steven Rostedt <rostedt@goodmis.org>
+
+commit 377ccbb483738f84400ddf5840c7dd8825716985 upstream.
+
+With the latest gcc compilers, they give a warning if
+__builtin_return_address() parameter is greater than 0. That is because if
+it is used by a function called by a top level function (or in the case of
+the kernel, by assembly), it can try to access stack frames outside the
+stack and crash the system.
+
+The tracing system uses __builtin_return_address() of up to 2! But it is
+well aware of the dangers that it may have, and has even added precautions
+to protect against it (see the thunk code in arch/x86/entry/thunk*.S)
+
+Linus originally added KBUILD_CFLAGS that would suppress the warning for the
+entire kernel, as simply adding KBUILD_CFLAGS to the tracing directory
+wouldn't work. The tracing directory plays a bit with the CFLAGS and
+requires a little more logic.
+
+This adds that special logic to only suppress the warning for the tracing
+directory. If it is used anywhere else outside of tracing, the warning will
+still be triggered.
+
+Link: http://lkml.kernel.org/r/20160728223043.51996267@grimm.local.home
+
+Tested-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile              |    1 -
+ kernel/trace/Makefile |    4 ++++
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -620,7 +620,6 @@ include arch/$(SRCARCH)/Makefile
+ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
+ KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
+-KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
+ ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+ KBUILD_CFLAGS += -Os
+--- a/kernel/trace/Makefile
++++ b/kernel/trace/Makefile
+@@ -1,4 +1,8 @@
++# We are fully aware of the dangers of __builtin_return_address()
++FRAME_CFLAGS := $(call cc-disable-warning,frame-address)
++KBUILD_CFLAGS += $(FRAME_CFLAGS)
++
+ # Do not instrument the tracer itself:
+ ifdef CONFIG_FUNCTION_TRACER
index 8a742fe20500e8b3757fd876fc68509be68915de..ecd73e89d614fb49beb99662b3eff0a7f51cb074 100644 (file)
@@ -7,3 +7,6 @@ ocfs2-dlm-fix-race-between-convert-and-migration.patch
 ocfs2-fix-start-offset-to-ocfs2_zero_range_for_truncate.patch
 revert-ocfs2-bump-up-o2cb-network-protocol-version.patch
 autofs-use-dentry-flags-to-block-walks-during-expire.patch
+disable-maybe-uninitialized-warning-globally.patch
+disable-frame-address-warning.patch
+makefile-mute-warning-for-__builtin_return_address-0-for-tracing-only.patch