diff options
author | Ian Moffett <ian@osmora.org> | 2025-06-24 02:33:11 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-06-24 02:33:11 -0400 |
commit | f2312b4af97185a266d1a145b90f36b4cdfb57b3 (patch) | |
tree | 441106d3fd6ee0c1df407d14ce545429e627f3b0 | |
parent | 56e6e20dbc29fd1906f8616a5eb1fafb9637a61c (diff) |
kernel: exit: Only kill leaf if not exiting
During an exit(), the parent needs to kill all of the child processes
that depend on it. However, there might be an occurrence where one or
more is already exiting and trying to kill such processes would be
problematic and may result in issues like double frees. This commit
ensures that the exiting parent only kills child processes that aren't
already exiting themselves.
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/kern/kern_exit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 2f9e344..c00f39b 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -129,7 +129,8 @@ exit1(struct proc *td, int flags) /* If we have any children, kill them too */ if (td->nleaves > 0) { TAILQ_FOREACH(procp, &td->leafq, leaf_link) { - exit1(procp, flags); + if (!ISSET(procp->flags, PROC_EXITING)) + exit1(procp, flags); } } |