[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-113b5e3720e79ad938374163c1b8e295521dc9cf@git.kernel.org>
Date: Wed, 27 May 2015 07:17:37 -0700
From: tip-bot for Borislav Petkov <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, brgerst@...il.com, bp@...en8.de,
peterz@...radead.org, torvalds@...ux-foundation.org,
mingo@...nel.org, mmarek@...e.cz, luto@...capital.net,
dvlasenk@...hat.com, tglx@...utronix.de, jpoimboe@...hat.com,
luto@...nel.org, akpm@...ux-foundation.org, a.p.zijlstra@...llo.nl,
bp@...e.de, linux-kernel@...r.kernel.org
Subject: [tip:x86/debug] x86/Documentation: Adapt Ingo'
s explanation on printing backtraces
Commit-ID: 113b5e3720e79ad938374163c1b8e295521dc9cf
Gitweb: http://git.kernel.org/tip/113b5e3720e79ad938374163c1b8e295521dc9cf
Author: Borislav Petkov <bp@...e.de>
AuthorDate: Tue, 26 May 2015 10:28:20 +0200
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Wed, 27 May 2015 14:39:47 +0200
x86/Documentation: Adapt Ingo's explanation on printing backtraces
Hold it down for future reference, as the question about the
question mark in stack traces keeps popping up.
Signed-off-by: Borislav Petkov <bp@...e.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Michal Marek <mmarek@...e.cz>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: live-patching@...r.kernel.org
Link: http://lkml.kernel.org/r/1432628901-18044-18-git-send-email-bp@alien8.de
Link: http://lkml.kernel.org/r/20150521101614.GA10889@gmail.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
Documentation/x86/kernel-stacks | 44 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/Documentation/x86/kernel-stacks b/Documentation/x86/kernel-stacks
index c3c935b..0f3a6c2 100644
--- a/Documentation/x86/kernel-stacks
+++ b/Documentation/x86/kernel-stacks
@@ -95,3 +95,47 @@ The currently assigned IST stacks are :-
assumptions about the previous state of the kernel stack.
For more details see the Intel IA32 or AMD AMD64 architecture manuals.
+
+
+Printing backtraces on x86
+--------------------------
+
+The question about the '?' preceding function names in an x86 stacktrace
+keeps popping up, here's an indepth explanation. It helps if the reader
+stares at print_context_stack() and the whole machinery in and around
+arch/x86/kernel/dumpstack.c.
+
+Adapted from Ingo's mail, Message-ID: <20150521101614.GA10889@...il.com>:
+
+We always scan the full kernel stack for return addresses stored on
+the kernel stack(s) [*], from stack top to stack bottom, and print out
+anything that 'looks like' a kernel text address.
+
+If it fits into the frame pointer chain, we print it without a question
+mark, knowing that it's part of the real backtrace.
+
+If the address does not fit into our expected frame pointer chain we
+still print it, but we print a '?'. It can mean two things:
+
+ - either the address is not part of the call chain: it's just stale
+ values on the kernel stack, from earlier function calls. This is
+ the common case.
+
+ - or it is part of the call chain, but the frame pointer was not set
+ up properly within the function, so we don't recognize it.
+
+This way we will always print out the real call chain (plus a few more
+entries), regardless of whether the frame pointer was set up correctly
+or not - but in most cases we'll get the call chain right as well. The
+entries printed are strictly in stack order, so you can deduce more
+information from that as well.
+
+The most important property of this method is that we _never_ lose
+information: we always strive to print _all_ addresses on the stack(s)
+that look like kernel text addresses, so if debug information is wrong,
+we still print out the real call chain as well - just with more question
+marks than ideal.
+
+[*] For things like IRQ and IST stacks, we also scan those stacks, in
+ the right order, and try to cross from one stack into another
+ reconstructing the call chain. This works most of the time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists