Re: [PATCH] lockdep: Quiet gcc about dangerous __builtin_return_address() operations
From: Borislav Petkov
Date: Thu Sep 08 2016 - 14:33:25 EST
On Thu, Sep 08, 2016 at 12:34:33PM -0400, Steven Rostedt wrote:
> [
> Boris, does this quiet gcc for you?
> I haven't fully tested this yet, as I still don't have a compiler
> that does the warning.
gcc 6.x should be available in your distro...
> Gcc's new warnings about __builtin_return_address(n) operations with
> n > 0 is popping up around the kernel. The operation is dangerous, and
> the warning is "good to know". But there's instances that we use
> __builtin_return_address(n) with n > 0 and are aware of the issues,
> and work around them. And its used mostly for tracing and debugging. In
> these cases, the warning becomes a distraction and is not helpful.
>
> To get better lock issue traces, a function like get_lock_parent_ip()
> uses __builtin_return_address() to find the caller of the lock, and
> skip over the internal callers of the lock itself. Currently it is only
> used in the kernel/ directory and only if certain configs are enabled.
>
> Create a new config called CONFIG_USING_GET_LOCK_PARENT_IP that gets
> selected when another config relies on get_lock_parent_ip(), and this
> will now enable the function get_lock_parent_ip(), otherwise it wont be
> defined. It will also disable the frame-address warnings from gcc in
> the kernel directory.
>
> Reported-by: Borislav Petkov <bp@xxxxxxxxx>
-and-tested-by: me
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Thanks Steve!
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.