All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: fengguang.wu@intel.com, tglx@linutronix.de, lkp@01.org,
	penguin-kernel@I-love.SAKURA.ne.jp, jpoimboe@redhat.com,
	peterz@infradead.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	byungchul.park@lge.com, hpa@zytor.com
Subject: [tip:x86/urgent] x86/unwind: Align stack pointer in unwinder dump
Date: Tue, 10 Oct 2017 07:55:57 -0700	[thread overview]
Message-ID: <tip-99bd28a49b150e4b938313a63b5532d95ba77885@git.kernel.org> (raw)
In-Reply-To: <2f540c515946ab09ed267e1a1d6421202a0cce08.1507597785.git.jpoimboe@redhat.com>

Commit-ID:  99bd28a49b150e4b938313a63b5532d95ba77885
Gitweb:     https://git.kernel.org/tip/99bd28a49b150e4b938313a63b5532d95ba77885
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Mon, 9 Oct 2017 20:20:04 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 10 Oct 2017 12:49:49 +0200

x86/unwind: Align stack pointer in unwinder dump

When printing the unwinder dump, the stack pointer could be unaligned,
for one of two reasons:

- stack corruption; or

- GCC created an unaligned stack.

There's no way for the unwinder to tell the difference between the two,
so we have to assume one or the other.  GCC unaligned stacks are very
rare, and have only been spotted before GCC 5.  Presumably, if we're
doing an unwinder stack dump, stack corruption is more likely than a
GCC unaligned stack.  So always align the stack before starting the
dump.

Reported-and-tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-and-tested-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Byungchul Park <byungchul.park@lge.com>
Cc: LKP <lkp@01.org>
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/2f540c515946ab09ed267e1a1d6421202a0cce08.1507597785.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/unwind_frame.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/unwind_frame.c b/arch/x86/kernel/unwind_frame.c
index 4949bbc..81aca07 100644
--- a/arch/x86/kernel/unwind_frame.c
+++ b/arch/x86/kernel/unwind_frame.c
@@ -44,7 +44,8 @@ static void unwind_dump(struct unwind_state *state)
 			state->stack_info.type, state->stack_info.next_sp,
 			state->stack_mask, state->graph_idx);
 
-	for (sp = state->orig_sp; sp; sp = PTR_ALIGN(stack_info.next_sp, sizeof(long))) {
+	for (sp = PTR_ALIGN(state->orig_sp, sizeof(long)); sp;
+	     sp = PTR_ALIGN(stack_info.next_sp, sizeof(long))) {
 		if (get_stack_info(sp, state->task, &stack_info, &visit_mask))
 			break;
 

  reply	other threads:[~2017-10-10 15:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10  1:20 [PATCH 0/4] x86/unwind: 32-bit unwinder fixes Josh Poimboeuf
2017-10-10  1:20 ` Josh Poimboeuf
2017-10-10  1:20 ` [PATCH 1/4] x86/unwind: Fix dereference of untrusted pointer Josh Poimboeuf
2017-10-10  1:20   ` Josh Poimboeuf
2017-10-10 14:55   ` [tip:x86/urgent] " tip-bot for Josh Poimboeuf
2017-10-10  1:20 ` [PATCH 2/4] x86/unwind: Use MSB for frame pointer encoding on 32-bit Josh Poimboeuf
2017-10-10  1:20   ` Josh Poimboeuf
2017-10-10 14:55   ` [tip:x86/urgent] " tip-bot for Josh Poimboeuf
2017-10-10  1:20 ` [PATCH 3/4] x86/unwind: Align stack pointer in unwinder dump Josh Poimboeuf
2017-10-10  1:20   ` Josh Poimboeuf
2017-10-10 14:55   ` tip-bot for Josh Poimboeuf [this message]
2017-10-10  1:20 ` [PATCH 4/4] x86/unwind: Disable unwinder warnings on 32-bit Josh Poimboeuf
2017-10-10  1:20   ` Josh Poimboeuf
2017-10-10 14:56   ` [tip:x86/urgent] " 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-99bd28a49b150e4b938313a63b5532d95ba77885@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=byungchul.park@lge.com \
    --cc=fengguang.wu@intel.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=mingo@kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --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 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.