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


Groups > linux.kernel > #1595538

Re: v4.10: kernel stack frame pointer .. has bad value (null)

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject Re: v4.10: kernel stack frame pointer .. has bad value (null)
Date 2017-03-08 22:40 +0100
Message-ID <tiRtn-3QL-11@gated-at.bofh.it> (permalink)
References (5 earlier) <tisbD-31Z-15@gated-at.bofh.it> <tisbD-31Z-9@gated-at.bofh.it> <tislj-35L-11@gated-at.bofh.it> <tiNSN-1nX-1@gated-at.bofh.it> <tiOYy-25e-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[adding Steven Rostedt to CC as an FYI]

On Wed, Mar 08, 2017 at 10:25:01AM -0800, Linus Torvalds wrote:
> On Wed, Mar 8, 2017 at 9:37 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > - CONFIG_FUNCTION_GRAPH_TRACER sets it on x86-32 because of a gcc bug
> >   where the stack gets aligned before the mcount call.  This issue
> >   should be mostly obsolete as most modern compilers now have -mfentry.
> >   We could make it dependent on CC_USING_FENTRY.
> 
> Yeah. At some point we might even upgrade the compiler requirements to
> no longer accept the mcount model.

The plot slightly thickens...

So I was mistaken about this problem not existing with newer versions of
gcc, because the x86-32 ftrace code doesn't use -mfentry.  It still
relies on mcount.  So CONFIG_FUNCTION_GRAPH_TRACER will still need
-maccumulate-outgoing-args for *all* versions of gcc on x86-32.

(Of course, that situation would improve if ftrace on x86-32 were ported
to use -mfentry.)

Also, since -Os tells gcc to ignore -maccumulate-outgoing-args, this
means that CONFIG_FUNCTION_GRAPH_TRACER with mcount needs a dependency
on CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE.

I suspect these issues also affect x86-64 with gcc 4.4.x and 4.5.x,
which corresponds to the window after the funky DRAP prologue was
introduced but before -mfentry was introduced.

In summary, here are the changes I'm looking at:

- set -maccumulate-outgoing-args if CONFIG_FUNCTION_GRAPH_TRACER &&
  !CC_USING_ENTRY
  (for both 32- and 64-bit)

- somehow make CONFIG_FUNCTION_GRAPH_TRACER depend on either
  CC_USING_FENTRY or CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
  (for both 32- and 64-bit)

  (not sure how to do that -- maybe just fail the build in the
  graph tracer + mcount + '-Os' case)

- set -maccumulate-outgoing-args if CONFIG_JUMP_LABEL && gcc < 4.5.2
  (for both 32-bit and 64-bit)

-- 
Josh

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


Thread

Re: v4.10: kernel stack frame pointer .. has bad value (null) Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-03 01:20 +0100
  Re: v4.10: kernel stack frame pointer .. has bad value (null) Pavel Machek <pavel@ucw.cz> - 2017-03-06 17:50 +0100
    Re: v4.10: kernel stack frame pointer .. has bad value (null) Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-07 19:40 +0100
      Re: v4.10: kernel stack frame pointer .. has bad value (null) Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-07 19:40 +0100
      Re: v4.10: kernel stack frame pointer .. has bad value (null) Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-07 19:50 +0100
        Re: v4.10: kernel stack frame pointer .. has bad value (null) Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-08 18:50 +0100
          Re: v4.10: kernel stack frame pointer .. has bad value (null) Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-08 20:00 +0100
            Re: v4.10: kernel stack frame pointer .. has bad value (null) Andy Lutomirski <luto@amacapital.net> - 2017-03-08 20:10 +0100
            Re: v4.10: kernel stack frame pointer .. has bad value (null) Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-08 22:40 +0100
              Re: v4.10: kernel stack frame pointer .. has bad value (null) Steven Rostedt <rostedt@goodmis.org> - 2017-03-09 15:20 +0100
                Re: v4.10: kernel stack frame pointer .. has bad value (null) Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-09 19:40 +0100
            Re: v4.10: kernel stack frame pointer .. has bad value (null) Pavel Machek <pavel@ucw.cz> - 2017-03-09 00:20 +0100
              Re: v4.10: kernel stack frame pointer .. has bad value (null) Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-09 10:40 +0100
                Re: v4.10: kernel stack frame pointer .. has bad value (null) Pavel Machek <pavel@ucw.cz> - 2017-03-09 12:00 +0100
                Re: v4.10: kernel stack frame pointer .. has bad value (null) Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-09 13:20 +0100
                Compiling kernels faster (was Re: v4.10: kernel stack frame pointer  .. has bad value (null)) Pavel Machek <pavel@ucw.cz> - 2017-03-10 14:20 +0100
                Re: Compiling kernels faster (was Re: v4.10: kernel stack frame  pointer .. has bad value (null)) Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-10 14:30 +0100
                Re: Compiling kernels faster (was Re: v4.10: kernel stack frame  pointer .. has bad value (null)) Willy Tarreau <w@1wt.eu> - 2017-03-10 15:20 +0100
              Old compiler versions (was Re: v4.10: kernel stack frame pointer ..  has bad value (null)) Pavel Machek <pavel@ucw.cz> - 2017-03-09 12:00 +0100
                Re: Old compiler versions (was Re: v4.10: kernel stack frame pointer  .. has bad value (null)) Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-09 19:10 +0100
              Re: v4.10: kernel stack frame pointer .. has bad value (null) Peter Zijlstra <peterz@infradead.org> - 2017-03-09 16:40 +0100
                Re: v4.10: kernel stack frame pointer .. has bad value (null) Pavel Machek <pavel@ucw.cz> - 2017-03-09 22:20 +0100
    Re: v4.10: kernel stack frame pointer .. has bad value (null) Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-07 19:40 +0100
      Re: v4.10: kernel stack frame pointer .. has bad value (null) Andy Lutomirski <luto@amacapital.net> - 2017-03-07 20:00 +0100
      Re: v4.10: kernel stack frame pointer .. has bad value (null) Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-07 20:50 +0100

csiph-web