warning: calling â__builtin_return_addressâ with a nonzero argument is unsafe
From: Linus Torvalds
Date: Wed Jul 27 2016 - 19:01:10 EST
So almost all of our __builtin_return_address() users use a zero
argument, but we have a couple in-tree. They all seem to be related to
tracing:
kernel/trace/trace_irqsoff.c
kernel/trace/trace_sched_wakeup.c
and it causes a fair number of lines of warning noise on current
kernels with at least gcc-6.1.1. See
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
that says
"-Wframe-address:
Warn when the â__builtin_frame_addressâ or
â__builtin_return_addressâ is called with an argument greater than 0.
Such calls may return indeterminate values or crash the program. The
warning is included in -Wall"
I can just add a
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
in the main Makefile, and that is indeed what I have in my tree right
now and will likely commit soon. The warning isn't actually helpful
for us, and there doesn't seem to be any other way to turn it off. At
the same time, there is a somewhat valid reason for that warning
existing, so I'm wondering if the tracing code could perhaps try to
change.
I detest having lots of warnings when doing my test builds, because
the uninteresting warnings often hide real ones that might actually
matter.
Comments?
Linus