[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c32c47c68a0ae701088c5b2c3798856ed16746ae@git.kernel.org>
Date: Thu, 27 Oct 2016 00:37:36 -0700
From: tip-bot for Josh Poimboeuf <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: torvalds@...ux-foundation.org, jpoimboe@...hat.com,
tglx@...utronix.de, dvlasenk@...hat.com, luto@...nel.org,
peterz@...radead.org, linux-kernel@...r.kernel.org,
brgerst@...il.com, mingo@...nel.org, hpa@...or.com, bp@...en8.de
Subject: [tip:x86/asm] x86/unwind: Warn on bad frame pointer
Commit-ID: c32c47c68a0ae701088c5b2c3798856ed16746ae
Gitweb: http://git.kernel.org/tip/c32c47c68a0ae701088c5b2c3798856ed16746ae
Author: Josh Poimboeuf <jpoimboe@...hat.com>
AuthorDate: Wed, 26 Oct 2016 10:41:48 -0500
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Thu, 27 Oct 2016 08:32:37 +0200
x86/unwind: Warn on bad frame pointer
Detect situations in the unwinder where the frame pointer refers to a
bad address, and print an appropriate warning.
Use printk_deferred_once() because the unwinder can be called with the
console lock by lockdep via save_stack_trace().
Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
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: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/03c888f6f7414d54fa56b393ea25482be6899b5f.1477496147.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/kernel/unwind_frame.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/unwind_frame.c b/arch/x86/kernel/unwind_frame.c
index 5795427..9be9a8f 100644
--- a/arch/x86/kernel/unwind_frame.c
+++ b/arch/x86/kernel/unwind_frame.c
@@ -123,8 +123,17 @@ bool unwind_next_frame(struct unwind_state *state)
}
/* make sure the next frame's data is accessible */
- if (!update_stack_state(state, next_frame, next_len))
- return false;
+ if (!update_stack_state(state, next_frame, next_len)) {
+ /*
+ * Don't warn on bad regs->bp. An interrupt in entry code
+ * might cause a false positive warning.
+ */
+ if (state->regs)
+ goto the_end;
+
+ goto bad_address;
+ }
+
/* move to the next frame */
if (regs) {
state->regs = regs;
@@ -136,6 +145,11 @@ bool unwind_next_frame(struct unwind_state *state)
return true;
+bad_address:
+ printk_deferred_once(KERN_WARNING
+ "WARNING: kernel stack frame pointer at %p in %s:%d has bad value %p\n",
+ state->bp, state->task->comm,
+ state->task->pid, next_bp);
the_end:
state->stack_info.type = STACK_TYPE_UNKNOWN;
return false;
Powered by blists - more mailing lists