Skip to content
Snippets Groups Projects
  • Eric W. Biederman's avatar
    49697335
    signal: Remove the helper signal_group_exit · 49697335
    Eric W. Biederman authored
    This helper is misleading.  It tests for an ongoing exec as well as
    the process having received a fatal signal.
    
    Sometimes it is appropriate to treat an on-going exec differently than
    a process that is shutting down due to a fatal signal.  In particular
    taking the fast path out of exit_signals instead of retargeting
    signals is not appropriate during exec, and not changing the the exit
    code in do_group_exit during exec.
    
    Removing the helper makes it more obvious what is going on as both
    cases must be coded for explicitly.
    
    While removing the helper fix the two cases where I have observed
    using signal_group_exit resulted in the wrong result.
    
    In exit_signals only test for SIGNAL_GROUP_EXIT so that signals are
    retargetted during an exec.
    
    In do_group_exit use 0 as the exit code during an exec as de_thread
    does not set group_exit_code.  As best as I can determine
    group_exit_code has been is set to 0 most of the time during
    de_thread.  During a thread group stop group_exit_code is set to the
    stop signal and when the thread group receives SIGCONT group_exit_code
    is reset to 0.
    
    Link: https://lkml.kernel.org/r/20211213225350.27481-8-ebiederm@xmission.com
    
    
    Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
    49697335
    History
    signal: Remove the helper signal_group_exit
    Eric W. Biederman authored
    This helper is misleading.  It tests for an ongoing exec as well as
    the process having received a fatal signal.
    
    Sometimes it is appropriate to treat an on-going exec differently than
    a process that is shutting down due to a fatal signal.  In particular
    taking the fast path out of exit_signals instead of retargeting
    signals is not appropriate during exec, and not changing the the exit
    code in do_group_exit during exec.
    
    Removing the helper makes it more obvious what is going on as both
    cases must be coded for explicitly.
    
    While removing the helper fix the two cases where I have observed
    using signal_group_exit resulted in the wrong result.
    
    In exit_signals only test for SIGNAL_GROUP_EXIT so that signals are
    retargetted during an exec.
    
    In do_group_exit use 0 as the exit code during an exec as de_thread
    does not set group_exit_code.  As best as I can determine
    group_exit_code has been is set to 0 most of the time during
    de_thread.  During a thread group stop group_exit_code is set to the
    stop signal and when the thread group receives SIGCONT group_exit_code
    is reset to 0.
    
    Link: https://lkml.kernel.org/r/20211213225350.27481-8-ebiederm@xmission.com
    
    
    Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
coredump.c 26.43 KiB