]> git.itanic.dy.fi Git - linux-stable/commit
fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent
authorEddy Wu <itseddy0402@gmail.com>
Sat, 7 Nov 2020 06:47:22 +0000 (14:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 09:24:03 +0000 (10:24 +0100)
commit66be43d81870c55637c2f32d8088d7184e93262a
tree708dc0a2d998de3eab17ff287519af32d64f5291
parent5ca7f073e680ff2e56756a9b6bffcd55085d292c
fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent

commit b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948 upstream.

current->group_leader->exit_signal may change during copy_process() if
current->real_parent exits.

Move the assignment inside tasklist_lock to avoid the race.

Signed-off-by: Eddy Wu <eddy_wu@trendmicro.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/fork.c