Page MenuHomePhabricator

On Linux, clear the signal mask of the launched inferior
ClosedPublic

Authored by ybelkadi on Aug 18 2015, 11:44 PM.

Details

Summary

Due to fork()/execve(), the launched inferior inherits the signal mask of its parent (lldb-server). But because lldb-server modifies its signal mask (It blocks SIGCHLD, for example), the inferior starts with some signals being initially blocked.

One consequence is that TestCallThatRestarts.ExprCommandThatRestartsTestCase (test/expression_command/call-restarts) fails because sigchld_handler() in lotta-signals.c is not called, due to the SIGCHLD signal being blocked.

To prevent the signal masking done by lldb-server from affecting the created inferior, the signal mask of the inferior is now cleared before the execve().

Diff Detail

Repository
rL LLVM

Event Timeline

ybelkadi updated this revision to Diff 32506.Aug 18 2015, 11:44 PM
ybelkadi retitled this revision from to On Linux, clear the signal mask of the launched inferior.
ybelkadi updated this object.
ybelkadi added reviewers: labath, ovyalov.
ybelkadi added a subscriber: lldb-commits.
labath accepted this revision.Aug 19 2015, 1:57 AM
labath edited edge metadata.

Looks good. Thanks for catching this.

Does the test you mentioned pass after this, or does it still fail intermittently as the original bug indicates? If it seems to pass, you should also enable the test.

This revision is now accepted and ready to land.Aug 19 2015, 1:57 AM
ybelkadi updated this revision to Diff 32529.Aug 19 2015, 3:29 AM
ybelkadi edited edge metadata.

Yes, the test passes, but as PR19246 reported intermittent failures, I thought I'd wait for the results of the tests run by the bots.

Here is an updated patch also enabling the test. Could you please commit it if it's accepted?

Ok, I see what you mean. I will commit it with the test enabled, and I will keep an eye out on the buildbots.

This revision was automatically updated to reflect the committed changes.