提交 9f15c826 编写于 作者: M Matthew Wilcox 提交者: Kyle McMartin

[PARISC] Fix show_stack() when we can't kmalloc

show_stack() was calling kzalloc() to allocate a struct pt_regs.
This meant that *really* early stack dumps would cause a null pointer
dereference.  x86_64 allocates its pt_regs on the stack, so do the same.

Kyle actually committed this exact patch to CVS on
Wed Jul 26 14:32:39 2006 UTC, and never moved it across to git.
Bad Kyle.
Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
Signed-off-by: NKyle McMartin <kyle@parisc-linux.org>
上级 e6fc0449
......@@ -187,18 +187,19 @@ void show_stack(struct task_struct *task, unsigned long *s)
if (!task) {
unsigned long sp;
struct pt_regs *r;
HERE:
asm volatile ("copy %%r30, %0" : "=r"(sp));
r = kzalloc(sizeof(struct pt_regs), GFP_KERNEL);
if (!r)
return;
r->iaoq[0] = (unsigned long)&&HERE;
r->gr[2] = (unsigned long)__builtin_return_address(0);
r->gr[30] = sp;
unwind_frame_init(&info, current, r);
kfree(r);
{
struct pt_regs r;
memset(&r, 0, sizeof(struct pt_regs));
r.iaoq[0] = (unsigned long)&&HERE;
r.gr[2] = (unsigned long)__builtin_return_address(0);
r.gr[30] = sp;
unwind_frame_init(&info, current, &r);
}
} else {
unwind_frame_init_from_blocked_task(&info, task);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册