linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Marco Elver <elver@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@alien8.de>, Rong Chen <rong.a.chen@intel.com>,
	kernel test robot <lkp@intel.com>,
	"Li, Philip" <philip.li@intel.com>, x86-ml <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kees Cook <keescook@chromium.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	Daniel Kiss <daniel.kiss@arm.com>,
	momchil.velikov@arm.com
Subject: Re: [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e
Date: Thu, 17 Sep 2020 13:39:23 -0500	[thread overview]
Message-ID: <20200917183923.b5b2btxt26u73fgx@treble> (raw)
In-Reply-To: <CAKwvOd=T3w1eqwBkpa8_dJjbOLMTTDshfevT3EuQD4aNn4e_ZQ@mail.gmail.com>

On Wed, Sep 16, 2020 at 11:22:02AM -0700, Nick Desaulniers wrote:
> I looked into this a bit, and IIRC, the issue was that compiler
> generated functions aren't very good about keeping track of whether
> they should or should not emit framepointer setup/teardown
> prolog/epilogs.  In LLVM's IR, -fno-omit-frame-pointer gets attached
> to every function as a function level attribute.
> https://godbolt.org/z/fcn9c6 ("frame-pointer"="all").
> 
> There were some recent LLVM patches for BTI (arm64) that made some BTI
> related command line flags module level attributes, which I thought
> was interesting; I was wondering last night if -fno-omit-frame-pointer
> and maybe even the level of stack protector should be?  I guess LTO
> would complicate things; not sure it would be good to merge modules
> with different attributes; I'm not sure how that's handled today in
> LLVM.
> 
> Basically, when the compiler is synthesizing a new function
> definition, it should check whether a frame pointer should be emitted
> or not.  We could do that today by maybe scanning all other function
> definitions for the presence of "frame-pointer"="all" fn attr,
> breaking early if we find one, and emitting the frame pointer setup in
> that case.  Though I guess it's "frame-pointer"="none" otherwise, so
> maybe checking any other fn def would be fine; I don't see any C fn
> attr's that allow you to keep frame pointers or not.  What's tricky is
> that the front end flag was resolved much earlier than where this code
> gets generated, so it would need to look for traces that the flag ever
> existed, which sounds brittle on paper to me.

For code generated by the kernel at runtime, our current (x86) policy is
"always use frame pointers for non-leaf functions".

A lot of this compiler talk is over my head, but if *non-leaf* generated
functions are rare enough then it might be worth considering to just
always use frame pointers for them.

-- 
Josh


  parent reply	other threads:[~2020-09-17 18:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 13:42 [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e kernel test robot
2020-09-15 13:55 ` Borislav Petkov
2020-09-15 14:18   ` Rong Chen
2020-09-15 14:41     ` Borislav Petkov
2020-09-15 16:05     ` Borislav Petkov
2020-09-15 17:02       ` Josh Poimboeuf
2020-09-15 17:21         ` Borislav Petkov
2020-09-15 17:34           ` Borislav Petkov
2020-09-15 17:41             ` Nick Desaulniers
2020-09-15 18:01               ` Borislav Petkov
2020-09-15 18:04                 ` Nick Desaulniers
2020-09-15 17:40           ` Nick Desaulniers
2020-09-15 18:09             ` Marco Elver
2020-09-16  8:30               ` peterz
2020-09-16  8:46                 ` Marco Elver
2020-09-16  9:06                   ` peterz
2020-09-16  9:33                     ` Marco Elver
2020-09-16 18:22                   ` Nick Desaulniers
2020-09-16 18:51                     ` Marco Elver
2020-09-17  4:11                       ` Fangrui Song
     [not found]                       ` <333D40A0-4550-4309-9693-1ABA4AC75399@arm.com>
2020-09-17 11:04                         ` Mark Rutland
2020-09-17 11:16                           ` Daniel Kiss
2020-09-17 18:39                     ` Josh Poimboeuf [this message]
2020-09-15 17:44         ` Nick Desaulniers
2020-09-15 20:12         ` Nick Desaulniers
2020-09-15 20:49           ` Borislav Petkov
2020-09-15 21:02             ` Josh Poimboeuf
2020-09-15 21:14               ` Borislav Petkov
2020-09-15 22:34               ` Nick Desaulniers
2020-09-16  7:03                 ` Ilie Halip
2020-09-16  8:59                 ` Marco Elver
2020-09-21 16:51                 ` [tip: objtool/core] objtool: Ignore unreachable trap after call to noreturn functions tip-bot2 for Ilie Halip
2020-09-15 21:50             ` [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e Arvind Sankar
2020-09-15 21:59               ` Nick Desaulniers
2020-09-15 22:44                 ` Arvind Sankar
2020-09-16 11:34               ` Borislav Petkov
2020-09-16 18:28                 ` Nick Desaulniers
2020-09-16 18:48                   ` Borislav Petkov
2020-09-15 21:13           ` Nick Desaulniers
2020-09-15 21:28             ` Josh Poimboeuf
2020-09-15 23:35               ` Marco Elver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200917183923.b5b2btxt26u73fgx@treble \
    --to=jpoimboe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=daniel.kiss@arm.com \
    --cc=elver@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=masahiroy@kernel.org \
    --cc=momchil.velikov@arm.com \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=philip.li@intel.com \
    --cc=rong.a.chen@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).