mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: kernel list <linux-kernel@vger.kernel.org>,
	mingo@kernel.org, luto@kernel.org, bp@alien8.de,
	brgerst@gmail.com, dvlasenk@redhat.com, hpa@zytor.com,
	torvalds@linux-foundation.org, peterz@infradead.org,
	tglx@linutronix.de
Subject: Re: v4.10: kernel stack frame pointer .. has bad value (null)
Date: Tue, 7 Mar 2017 11:38:21 -0600	[thread overview]
Message-ID: <20170307173821.yknj5htr7plgdwxv@treble> (raw)
In-Reply-To: <20170306163807.GA20689@amd>

On Mon, Mar 06, 2017 at 05:38:07PM +0100, Pavel Machek wrote:
> Sorry for the delay. This is on v4.11-rc1, but that should be similar.
> 
> pavel@duo:~$ gcc --version
> gcc (Debian 4.9.2-10) 4.9.2
> 
> And here's the disassemble:
> 
> c402d200 <start_secondary>:
> c402d200:       57                      push   %edi
> c402d201:       8d 7c 24 08             lea    0x8(%esp),%edi
> c402d205:       83 e4 f8                and    $0xfffffff8,%esp
> c402d208:       ff 77 fc                pushl  -0x4(%edi)
> c402d20b:       55                      push   %ebp
> c402d20c:       89 e5                   mov    %esp,%ebp
> c402d20e:       57                      push   %edi
> c402d20f:       56                      push   %esi
> c402d210:       83 ec 10                sub    $0x10,%esp

Thanks.  This confirms what I was thinking, the function prologue is
wack.  It's realigning the stack, but it's not the "normal" realign
pattern.  Instead it makes a fake frame header, which saves a duplicate
copy of the return address ("pushl -0x4(%edi)") in a place the unwinder
wasn't expecting.

I did some digging in gcc to figure out why this can happen.  gcc uses
something called a Dynamic Realign Argument Pointer (DRAP), which, when
enabled, makes a prologue like the above.  It's almost always enabled
for aligned stacks when -maccumulate-outgoing-args isn't set.

So I'm thinking we should have -maccumulate-outgoing-args always enabled
on x86_32 just like we already do on x86_64.

Can you verify the warning is fixed with the following patch?

-----

diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu
index 6647ed4..53ec1e4 100644
--- a/arch/x86/Makefile_32.cpu
+++ b/arch/x86/Makefile_32.cpu
@@ -61,7 +61,7 @@ ifeq ($(CONFIG_JUMP_LABEL), y)
 ADD_ACCUMULATE_OUTGOING_ARGS := y
 endif
 
-cflags-$(ADD_ACCUMULATE_OUTGOING_ARGS) += $(call cc-option,-maccumulate-outgoing-args)
+cflags-y += $(call cc-option,-maccumulate-outgoing-args)
 
 # Bug fix for binutils: this option is required in order to keep
 # binutils from generating NOPL instructions against our will.

  reply	other threads:[~2017-03-07 18:34 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 22:14 Pavel Machek
2017-02-21 23:12 ` Josh Poimboeuf
2017-02-21 23:15   ` H. Peter Anvin
2017-02-22 16:45     ` Josh Poimboeuf
2017-02-22 20:51       ` H. Peter Anvin
2017-02-22 21:15         ` Josh Poimboeuf
2017-02-22 21:05   ` Pavel Machek
2017-02-22 21:21     ` Josh Poimboeuf
2017-02-22 22:47       ` Pavel Machek
2017-02-22 22:56         ` Josh Poimboeuf
2017-02-22 23:18           ` Josh Poimboeuf
2017-02-23 20:10             ` Pavel Machek
2017-02-25  5:04               ` Josh Poimboeuf
2017-03-02 23:45                 ` Josh Poimboeuf
2017-03-06 16:38                   ` Pavel Machek
2017-03-07 17:38                     ` Josh Poimboeuf [this message]
2017-03-07 17:52                       ` Linus Torvalds
2017-03-07 17:59                         ` Andy Lutomirski
2017-03-07 18:28                           ` Josh Poimboeuf
2017-03-07 18:30                             ` Josh Poimboeuf
2017-03-07 18:40                             ` Linus Torvalds
2017-03-08 17:37                               ` Josh Poimboeuf
2017-03-08 18:25                                 ` Linus Torvalds
2017-03-08 18:54                                   ` Andy Lutomirski
2017-03-08 21:22                                   ` Pavel Machek
2017-03-09  9:38                                     ` Geert Uytterhoeven
2017-03-09 10:56                                       ` Pavel Machek
2017-03-09 12:16                                         ` Geert Uytterhoeven
2017-03-10 13:17                                           ` Compiling kernels faster (was Re: v4.10: kernel stack frame pointer .. has bad value (null)) Pavel Machek
2017-03-10 13:28                                             ` Geert Uytterhoeven
2017-03-10 14:15                                             ` Willy Tarreau
2017-03-09 10:49                                     ` Old compiler versions " Pavel Machek
2017-03-09 18:05                                       ` Linus Torvalds
2017-03-09 15:29                                     ` v4.10: kernel stack frame pointer .. has bad value (null) Peter Zijlstra
2017-03-09 21:12                                       ` Pavel Machek
2017-03-08 21:29                                   ` Josh Poimboeuf
2017-03-09 14:14                                     ` Steven Rostedt
2017-03-09 18:31                                       ` Josh Poimboeuf
2017-03-16 15:42                                     ` [PATCH] x86: mostly disable '-maccumulate-outgoing-args' Josh Poimboeuf
2017-03-16 17:32                                       ` Steven Rostedt
2017-03-16 18:36                                         ` Josh Poimboeuf
2017-03-16 18:53                                           ` Josh Poimboeuf
2017-03-16 19:04                                             ` Josh Poimboeuf
2017-03-16 19:07                                               ` Steven Rostedt
2017-03-16 19:06                                           ` Steven Rostedt
2017-03-16 19:31                                       ` [PATCH v2] " Josh Poimboeuf
2017-03-22  7:51                                         ` Ingo Molnar
2017-03-22 15:48                                           ` Josh Poimboeuf
2017-03-28  8:13                                         ` [tip:x86/urgent] x86/build: Mostly " tip-bot for Josh Poimboeuf
2017-03-28 16:17                                           ` Josh Poimboeuf
2017-03-30  9:58                                         ` tip-bot for Josh Poimboeuf

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=20170307173821.yknj5htr7plgdwxv@treble \
    --to=jpoimboe@redhat.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®