Re: warning: calling â__builtin_return_addressâ with a nonzero argument is unsafe
From: Steven Rostedt
Date: Wed Jul 27 2016 - 23:52:46 EST
On Wed, 27 Jul 2016 20:21:50 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, Jul 27, 2016 at 6:58 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > On Wed, 27 Jul 2016 16:00:54 -0700
> > Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >>
> >> I can just add a
> >>
> >> KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
> >
> > I like this solution.
>
> Ok. Pushed out. As long as people are aware of this, and are hopefully
> at least looking for potential alternatives, it's fine.
I just looked at your patch. Would this work if you moved that
KBUILD_CFLAGS to the tracing directory? Something like the below (never
compiled or tested).
This way we still get warnings from other users.
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
diff --git a/Makefile b/Makefile
index 393b615..d384848 100644
--- 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
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index 979e7bf..48079dd 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -1,4 +1,7 @@
+# We are fully aware of the dangers of __builtin_return_address() > 0
+KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
+
# Do not instrument the tracer itself:
ifdef CONFIG_FUNCTION_TRACER