Re: [PATCH 1/2] x86/dumpstack: on oops do not rewind stack for kthread

From: Andy Lutomirski
Date: Thu Oct 20 2016 - 19:07:56 EST


On Wed, Sep 21, 2016 at 8:43 AM, Roman Pen
<roman.penyaev@xxxxxxxxxxxxxxxx> wrote:
> kthread uses stack and keeps completion structure on it to be woken up
> on vfork_done completion.
>
> In commit 2deb4be28 Andy Lutomirski rewinds the stack unconditionally
> and further completion of task->vfork_done for any kthread leads to stack
> corruption (or infinite spin on attempt to spin lock on garbage memory).

This is sort of okay, but it will blow up pretty badly if a kthread
overflows its stack. Would it make more sense to change
rewind_stack_do_exit() to leave a big enough gap at the top of the
stack to avoid clobbering the completion?

--Andy