git: DragonFly_RELEASE_6_4 procctl(2): Improve PROC_REAP_KILL to handle reparenting race

Aaron LI aly at crater.dragonflybsd.org
Thu Nov 12 23:21:39 PST 2026


commit ba66a2f6a36ab48f73cf664d44ac677b84a08e5b
Author: Aaron LI <aly at aaronly.me>
Date:   Mon Mar 17 13:36:58 2025 +0800

    procctl(2): Improve PROC_REAP_KILL to handle reparenting race
    
    During the process tree iteration, a process or a process subtree might
    be reparented (because of SIGTERM/SIGKILL or ptrace/debug).  In order to
    handle that race, we reset the p_reaptid to 0 whenever a process gets
    reparented, and then check the p_reaptid value during the iteration.  If
    a reparent is detected, we restart the iteration.
    
    Suggested-by: dillon
    Reviewed-by: dillon

Summary of changes:
 sys/kern/kern_exit.c | 2 ++
 sys/kern/kern_fork.c | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ba66a2f6a36ab48f73cf664d44ac677b84a08e5b


-- 
DragonFly BSD source repository


More information about the Commits mailing list