Note that there are some explanatory texts on larger screens.

plurals
  1. PONot receiving SIGCHLD for processes executed with sudo
    text
    copied!<p>I'm currently in the process of writing a shell. I execute processes and utilize a <code>SIGCHLD</code> signal handler to clean up (wait on them) when they are complete.</p> <p>Everything has been working -- except when I execute processes which escalate privileges with <code>sudo</code>. In these cases, I never get a <code>SIGCHLD</code> signal -- so I never know that the process has completed executing.</p> <p>When I receive a command such as <code>sudo ls</code>, I execute the program <code>sudo</code> and then provide <code>ls</code> as a parameter. I perform this execution with <code>execvp</code>.</p> <p>If I take a look at <code>ps -aux</code> after my shell has executed <code>sudo ls</code>, I see the following:</p> <pre><code>root 4795 0.0 0.0 4496 1160 pts/29 S+ 16:51 0:00 sudo ls root 4796 0.0 0.0 0 0 pts/29 Z+ 16:51 0:00 [ls] &lt;defunct&gt; </code></pre> <p>So, <code>sudo</code> ran and got assigned <code>pid = 4795</code>, with the child (ls) being assigned <code>4796</code>. The child has completed its task and is now sitting in a zombie state. <code>sudo</code> doesn't seem to want to reap the zombie process and just sits there.</p> <p>I would like to know what is causing this behavior -- I've tried different techniques to cleanup these zombie processes, such as running my shell under <code>sudo</code> and waiting directly on <code>sudo</code> and the <code>PID</code> which <code>sudo</code> executes (4796 in the above example). None of these techniques have worked.</p> <p>As always, any advise is appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload