From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 1/2] x86: Fix dumpstack_64 to keep state of "used" variable in loop
Date: Wed, 02 Apr 2014 13:26:40 -0400 [thread overview]
Message-ID: <20140402173007.015989386@goodmis.org> (raw)
In-Reply-To: <20140402172639.994587272@goodmis.org>
[-- Attachment #1: 0001-x86-Fix-dumpstack_64-to-keep-state-of-used-variable-.patch --]
[-- Type: text/plain, Size: 2080 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Commit 2223f6f6eeaa "x86: Clean up dumpstack_64.c code" moved the used
variable to a local within the loop, but the in_exception_stack()
depended on being non-volatile with the ability to change it.
By always re-initializing the "used" variable to zero, it would cause
the in_exception_stack() to return the same thing each time, and
cause the dump_stack loop to go into an infinite loop.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
arch/x86/kernel/dumpstack_64.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 346b1df..74c262a 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -115,19 +115,18 @@ enum stack_type {
};
static enum stack_type
-analyze_stack(int cpu, struct task_struct *task,
- unsigned long *stack, unsigned long **stack_end, char **id)
+analyze_stack(int cpu, struct task_struct *task, unsigned long *stack,
+ unsigned long **stack_end, unsigned *used, char **id)
{
unsigned long *irq_stack;
unsigned long addr;
- unsigned used = 0;
addr = ((unsigned long)stack & (~(THREAD_SIZE - 1)));
if ((unsigned long)task_stack_page(task) == addr)
return STACK_IS_NORMAL;
*stack_end = in_exception_stack(cpu, (unsigned long)stack,
- &used, id);
+ used, id);
if (*stack_end)
return STACK_IS_EXCEPTION;
@@ -158,6 +157,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
struct thread_info *tinfo;
unsigned long *irq_stack;
unsigned long dummy;
+ unsigned used = 0;
int graph = 0;
int done = 0;
@@ -186,7 +186,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
enum stack_type stype;
char *id;
- stype = analyze_stack(cpu, task, stack, &stack_end, &id);
+ stype = analyze_stack(cpu, task, stack, &stack_end, &used, &id);
/* Default finish unless specified to continue */
done = 1;
--
1.8.5.3
next prev parent reply other threads:[~2014-04-02 17:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 17:26 [PATCH 0/2] x86: Fix perf deadlock caused by dumpstack cleanup Steven Rostedt
2014-04-02 17:26 ` Steven Rostedt [this message]
2014-04-02 17:26 ` [PATCH 2/2] x86: Fix dumpstack_64 irq stack handling Steven Rostedt
2014-04-02 18:46 ` [PATCH 0/2] x86: Fix perf deadlock caused by dumpstack cleanup Linus Torvalds
2014-04-02 19:37 ` Steven Rostedt
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=20140402173007.015989386@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--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
all inboxes | Powered by JetHome®