linuxsignalsforkclonesigchld

Change child process' termination signal at runtime


Using clone() to fork a process you can specify the signal a child process should send its parent on death instead the "normal" SIGCHLD.

Is it possible to change the set termination signal after the child was created? Either by the child or the parent?


Solution

  • I (quickly) scanned Linux' source for assignments to struct task_struct's member exit_signal. This seems only to happen in case of reparenting, in which case there are some more checks if the set signal is sane, e.g. that init won't receive a SIGKILL.

    That means the signal cannot be changed at runtime, most likely for security considerations.