From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, torvalds@linux-foundation.org,
dvlasenk@redhat.com, brgerst@gmail.com, jpoimboe@redhat.com,
bp@alien8.de, peterz@infradead.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, luto@kernel.org, hpa@zytor.com
Subject: [tip:x86/asm] x86/unwind: Properly zero-pad 32-bit values in unwind_dump()
Date: Wed, 19 Apr 2017 01:07:35 -0700 [thread overview]
Message-ID: <tip-9b135b234644c9881eee4f5d5683da0f4524722f@git.kernel.org> (raw)
In-Reply-To: <36b743812e7eb291d74af4e5067736736622daad.1492520933.git.jpoimboe@redhat.com>
Commit-ID: 9b135b234644c9881eee4f5d5683da0f4524722f
Gitweb: http://git.kernel.org/tip/9b135b234644c9881eee4f5d5683da0f4524722f
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Tue, 18 Apr 2017 08:12:56 -0500
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 19 Apr 2017 09:59:47 +0200
x86/unwind: Properly zero-pad 32-bit values in unwind_dump()
On x86-32, 32-bit stack values printed by unwind_dump() are confusingly
zero-padded to 16 characters (64 bits):
unwind stack type:0 next_sp: (null) mask:a graph_idx:0
f50cdebc: 00000000f50cdec4 (0xf50cdec4)
f50cdec0: 00000000c40489b7 (irq_exit+0x87/0xa0)
...
Instead, base the field width on the size of a long integer so that it
looks right on both x86-32 and x86-64.
x86-32:
unwind stack type:1 next_sp: (null) mask:0x2 graph_idx:0
c0ee9d98: c0ee9de0 (init_thread_union+0x1de0/0x2000)
c0ee9d9c: c043fd90 (__save_stack_trace+0x50/0xe0)
...
x86-64:
unwind stack type:1 next_sp: (null) mask:0x2 graph_idx:0
ffffffff81e03b88: ffffffff81e03c10 (init_thread_union+0x3c10/0x4000)
ffffffff81e03b90: ffffffff81048f8e (__save_stack_trace+0x5e/0x100)
...
Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/36b743812e7eb291d74af4e5067736736622daad.1492520933.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/unwind_frame.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/unwind_frame.c b/arch/x86/kernel/unwind_frame.c
index c461135..3ebe687 100644
--- a/arch/x86/kernel/unwind_frame.c
+++ b/arch/x86/kernel/unwind_frame.c
@@ -48,11 +48,13 @@ static void unwind_dump(struct unwind_state *state, unsigned long *sp)
if (zero) {
if (!prev_zero)
- printk_deferred("%p: %016x ...\n", sp, 0);
+ printk_deferred("%p: %0*x ...\n",
+ sp, BITS_PER_LONG/4, 0);
continue;
}
- printk_deferred("%p: %016lx (%pB)\n", sp, word, (void *)word);
+ printk_deferred("%p: %0*lx (%pB)\n",
+ sp, BITS_PER_LONG/4, word, (void *)word);
}
}
next prev parent reply other threads:[~2017-04-19 8:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 13:12 [PATCH 0/3] x86/unwind: unwind_dump() cleanups Josh Poimboeuf
2017-04-18 13:12 ` [PATCH 1/3] x86/unwind: properly zero-pad 32-bit values in unwind_dump() Josh Poimboeuf
2017-04-19 8:07 ` tip-bot for Josh Poimboeuf [this message]
2017-04-18 13:12 ` [PATCH 2/3] x86/unwind: prepend hex mask value with '0x' " Josh Poimboeuf
2017-04-19 8:08 ` [tip:x86/asm] x86/unwind: Prepend " tip-bot for Josh Poimboeuf
2017-04-18 13:12 ` [PATCH 3/3] x86/unwind: remove unused 'sp' argument " Josh Poimboeuf
2017-04-19 8:08 ` [tip:x86/asm] x86/unwind: Remove unused 'sp' parameter " 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=tip-9b135b234644c9881eee4f5d5683da0f4524722f@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--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
Powered by JetHome