提交 e6bcf562 编写于 作者: H Hideo Saito 提交者: Paul Mundt

sh: Fix kernel thread stack corruption with preempt.

When I run a preemptive kernel-2.6.20 for SH7780, a created
kthread(pdflush) can not exit by do_exit() in kernel_thread_helper. I
think that the created kthread should have a room for 'struct pt_regs'
space on the stack top, because __switch_to() will refer to the space as
follows using 'regs = task_pt_regs(prev)' and next condition may be true.
Signed-off-by: NHideo Saito <saito@densan.co.jp>
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 e523d93c
...@@ -250,8 +250,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -250,8 +250,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
childregs->regs[15] = usp; childregs->regs[15] = usp;
ti->addr_limit = USER_DS; ti->addr_limit = USER_DS;
} else { } else {
childregs->regs[15] = (unsigned long)task_stack_page(p) + childregs->regs[15] = (unsigned long)childregs;
THREAD_SIZE;
ti->addr_limit = KERNEL_DS; ti->addr_limit = KERNEL_DS;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册