fork: Duplicate task_struct before stack allocation
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 17 Feb 2022 10:24:00 +0000 (11:24 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 22 Feb 2022 21:25:01 +0000 (22:25 +0100)
commit546c42b2c5c161619736dd730d3df709181999d0
tree013cf1e1529b78a1708c79ce35c0b99320ee8e1d
parentbe9a2277cafd318976d59c41a7f45a934ec43b26
fork: Duplicate task_struct before stack allocation

alloc_thread_stack_node() already populates the task_struct::stack
member except on IA64. The stack pointer is saved and populated again
because IA64 needs it and arch_dup_task_struct() overwrites it.

Allocate thread's stack after task_struct has been duplicated as a
preparation for further changes.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/20220217102406.3697941-3-bigeasy@linutronix.de
kernel/fork.c