Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501767

[PATCH 3.12 12/84] Disable "frame-address" warning

From Jiri Slaby <jslaby@suse.cz>
Newsgroups linux.kernel
Subject [PATCH 3.12 12/84] Disable "frame-address" warning
Date 2016-10-17 10:30 +0200
Message-ID <stbt0-12r-29@gated-at.bofh.it> (permalink)
References <staZY-A3-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Linus Torvalds <torvalds@linux-foundation.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

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: Jiri Slaby <jslaby@suse.cz>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 39bfb82f7106..56ad5978a4e7 100644
--- a/Makefile
+++ b/Makefile
@@ -583,6 +583,7 @@ endif # $(dot-config)
 all: vmlinux
 
 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
-- 
2.10.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.12 00/84] 3.12.65-stable review Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:10 +0200
  [PATCH 3.12 01/84] gcov: disable tree-loop-im to reduce stack usage Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:20 +0200
    [PATCH 3.12 43/84] drm/radeon/si/dpm: add workaround for for Jet parts Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:20 +0200
    [PATCH 3.12 17/84] fix fault_in_multipages_...() on architectures with no-op access_ok() Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
    [PATCH 3.12 11/84] Disable "maybe-uninitialized" warning globally Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
    [PATCH 3.12 13/84] Makefile: Mute warning for __builtin_return_address(>0) for tracing only Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
    [PATCH 3.12 20/84] tracing: Move mutex to protect against resetting of seq data Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
    [PATCH 3.12 18/84] mtd: pmcmsp-flash: Allocating too much in init_msp_flash() Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
    [PATCH 3.12 12/84] Disable "frame-address" warning Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
    [PATCH 3.12 15/84] iwlegacy: avoid warning about missing braces Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
    [PATCH 3.12 14/84] net: caif: fix misleading indentation Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:30 +0200
  Re: [PATCH 3.12 00/84] 3.12.65-stable review Guenter Roeck <linux@roeck-us.net> - 2016-10-17 20:40 +0200
  Re: [PATCH 3.12 00/84] 3.12.65-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-10-18 00:20 +0200

csiph-web