linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andy Lutomirski <luto@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: WARNING: kernel stack frame pointer has bad value
Date: Wed, 19 Apr 2017 08:44:57 -0500	[thread overview]
Message-ID: <20170419134457.l7gdyuf4xbe4nns5@treble> (raw)
In-Reply-To: <20170418233714.14fbf55d@grimm.local.home>

On Tue, Apr 18, 2017 at 11:37:14PM -0400, Steven Rostedt wrote:
> Josh,
> 
> I'm starting to get a bunch of these warnings, and I'm thinking they
> are false positives. The stack frame error is recorded at a call from
> entry_SYSCALL_64_fastpath, where I would expect the bp to not be valid.
> 
> To trigger this, I only need to go into /sys/kernel/debug/tracing and
> echo function > current_tracer then cat trace. Maybe function tracer
> stack frames is messing it up some how, but it always fails at the
> entry call.
> 
> Here's the dump;
> 
>  WARNING: kernel stack frame pointer at ffff8800bda0ff30 in sshd:1090 has bad value 000055b32abf1fa8
...
>  ffff8800bda0ff20: ffff8800bda0ff30 (0xffff8800bda0ff30)
>  ffff8800bda0ff28: ffffffff810dc945 (SyS_rt_sigprocmask+0x5/0x1a0)
>  ffff8800bda0ff30: 000055b32abf1fa8 (0x55b32abf1fa8)
>  ffff8800bda0ff38: ffffffff81cf502a (entry_SYSCALL_64_fastpath+0x18/0xad)
>  ffff8800bda0ff40: 000055b32abf1fa8 (0x55b32abf1fa8)
>  ffff8800bda0ff48: ffffffff810dc945 (SyS_rt_sigprocmask+0x5/0x1a0)
>  ffff8800bda0ff50: ffffffff81cf502a (entry_SYSCALL_64_fastpath+0x18/0xad)

Thanks for reporting, I hadn't seen this one yet.

The problem is that the unwinder expects the last frame pointer to be at
a certain address (0xffff8800bda0ff48 in this case), so it can know that
it reached the end.  It's confused by the save_mcount_regs macro, which
builds some fake frames -- which is good -- but then the last frame is
at a different offset than what the unwinder expects.

Would it be possible for ftrace to rewrite the stack so that it looks
like this instead?

>  ffff8800bda0ff38: ffff8800bda0ff48 (0xffff8800bda0ff48)
>  ffff8800bda0ff40: ffffffff810dc945 (SyS_rt_sigprocmask+0x5/0x1a0)
>  ffff8800bda0ff48: 000055b32abf1fa8 (0x55b32abf1fa8)
>  ffff8800bda0ff50: ffffffff81cf502a (entry_SYSCALL_64_fastpath+0x18/0xad)

In other words it would overwrite the "SyS_rt_sigprocmask+0x5/0x1a0"
value on the stack at ffff8800bda0ff48 with the original bp, instead of
appending to the existing stack.  If you would be ok with such an
approach, I could take a stab at it.

The alternative would be to change the unwinder, but I would rather
avoid having to detect another special case if possible.

-- 
Josh

  reply	other threads:[~2017-04-19 13:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19  3:37 WARNING: kernel stack frame pointer has bad value Steven Rostedt
2017-04-19 13:44 ` Josh Poimboeuf [this message]
2017-04-19 14:12   ` Steven Rostedt
2017-04-19 16:38     ` Josh Poimboeuf
2018-04-19 15:57 syzbot
2018-04-19 17:28 ` Dmitry Vyukov

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=20170419134457.l7gdyuf4xbe4nns5@treble \
    --to=jpoimboe@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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).