Re: [PATCH v2 1/2] kthread: allocate kthread structure using kmalloc

From: Andy Lutomirski
Date: Mon Oct 24 2016 - 13:08:46 EST


On Mon, Oct 24, 2016 at 9:08 AM, Roman Pen
<roman.penyaev@xxxxxxxxxxxxxxxx> wrote:
> This patch avoids allocation of kthread structure on a stack, and simply
> uses kmalloc. Allocation on a stack became a huge problem (with memory
> corruption and all other not nice consequences) after the commit 2deb4be28
> by Andy Lutomirski, which rewinds the stack on oops, thus ooopsed kthread
> steps on a garbage memory while completion of task->vfork_done structure
> on the following path:

This is IMO a *huge* improvement.

Shouldn't the patch also remove the try_get_task_stack() /
put_task_stack() hackery in kthread.c, though?