diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2022-01-05 23:30:21 +0100 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2022-01-08 17:51:23 +0100 |
commit | 912616f142bfeb1dc41f40dbe7ce38331886a94a (patch) | |
tree | d29c454bf48689bce407da914b8d5fbe4a3ccbd4 /kernel/exit.c | |
parent | exit/xtensa: In arch/xtensa/entry.S:Linvalid_mask call make_task_dead (diff) | |
download | linux-912616f142bfeb1dc41f40dbe7ce38331886a94a.tar.xz linux-912616f142bfeb1dc41f40dbe7ce38331886a94a.zip |
exit: Guarantee make_task_dead leaks the tsk when calling do_task_exit
Change the task state to EXIT_DEAD and take an extra rcu_refernce
to guarantee the task will not be reaped and that it will not be
freed.
Link: https://lkml.kernel.org/r/YdUzjrLAlRiNLQp2@zeniv-ca.linux.org.uk
Pointed-out-by: Al Viro <viro@zeniv.linux.org.uk>
Fixes: 7f80a2fd7db9 ("exit: Stop poorly open coding do_task_dead in make_task_dead")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 6c4b04531f17..db4eeb7fc680 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -885,6 +885,8 @@ void __noreturn make_task_dead(int signr) if (unlikely(tsk->flags & PF_EXITING)) { pr_alert("Fixing recursive fault but reboot is needed!\n"); futex_exit_recursive(tsk); + tsk->exit_state = EXIT_DEAD; + refcount_inc(&tsk->rcu_users); do_task_dead(); } |