From: Ingo Molnar <mingo@kernel.org>
To: Marek Majkowski <marek@cloudflare.com>, Jiri Slaby <jslaby@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Rusty Russell <rusty@rustcorp.com.au>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Wrong symbol resolved for RIP on OOPS/BUG
Date: Thu, 7 Nov 2013 08:54:48 +0100 [thread overview]
Message-ID: <20131107075448.GA31926@gmail.com> (raw)
In-Reply-To: <1383767997-20765-1-git-send-email-marek@cloudflare.com>
* Marek Majkowski <marek@cloudflare.com> wrote:
> "%pB" is intended for return addresses, and actually resolves the
> address - 1. So it should only be used for backtraces. Plain
> instruction addresses should use "%pS", which resolves the given
> address.
>
> show_regs was using "%pB" to resolve the RIP symbol. This resolved the
> wrong symbol if the first instruction after a symbol created the
> OOPS/BUG. For example:
>
> 0000000000000049 <before>:
> 49: 90 nop
> 4a: 90 nop
> 4b: 90 nop
> 4c: 90 nop
> 000000000000004d <suicide>:
> 4d: ff 14 25 00 00 00 00 callq *0x0
> 54: c3 retq
>
> Will produce a message saying it's "before" that crashed, not "suicide".
>
> This problem only happens when the crash occurs in the first instruction
> after a symbol. Therefore it's unlikely to occur on kernels with frame
> pointers (CONFIG_FRAME_POINTER=y).
>
> Signed-off-by: Marek Majkowski <marek@cloudflare.com>
>
> diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
> index deb6421..4c90013 100644
> --- a/arch/x86/kernel/dumpstack.c
> +++ b/arch/x86/kernel/dumpstack.c
> @@ -27,6 +27,12 @@ static int die_counter;
>
> void printk_address(unsigned long address, int reliable)
> {
> + pr_cont(" [<%p>] %s%pS\n",
> + (void *)address, reliable ? "" : "? ", (void *)address);
> +}
> +
> +static void printk_trace_address(unsigned long address, int reliable)
> +{
> pr_cont(" [<%p>] %s%pB\n",
> (void *)address, reliable ? "" : "? ", (void *)address);
> }
> @@ -151,7 +157,7 @@ static void print_trace_address(void *data, unsigned long addr, int reliable)
> {
> touch_nmi_watchdog();
> printk(data);
> - printk_address(addr, reliable);
> + printk_trace_address(addr, reliable);
> }
>
> static const struct stacktrace_ops print_trace_ops = {
There's a recent commit from Jiri Slaby that I think tries to address the
same problem:
8d4c812a3e5f x86/dumpstack: Fix printk_address for direct addresses
You can find it in the -tip tree:
git remote add tip git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Thanks,
Ingo
next prev parent reply other threads:[~2013-11-07 7:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 19:59 [PATCH] Wrong symbol resolved for RIP on OOPS/BUG Marek Majkowski
2013-11-07 7:54 ` Ingo Molnar [this message]
2013-11-07 16:25 ` H. Peter Anvin
2013-11-11 11:45 ` Ingo Molnar
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=20131107075448.GA31926@gmail.com \
--to=mingo@kernel.org \
--cc=hpa@zytor.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=marek@cloudflare.com \
--cc=mingo@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=tglx@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.