minijail exits when forwarding signal to child process |
|||||
Issue descriptionRecently minijail gained the ability to forward signals to its sandboxed process. After forwarding the signal, minijail exits. This is generally fine when forwarding e.g. SIGTERM, but may be surprising if a non-terminal signal is forwarded or if the child process does not exit as expected. This seems to be caused by minijail's waitpid call being terminated prior to its signal handler being called. One solution might be to set the SA_RESTART flag with sigaction(2).
,
Jun 7 2017
,
Jun 7 2017
we are setting SA_RESTART already in the forwarding handlers. mj shouldn't exit for any signal ... it should forward them all and only exit once its child does.
that said, i can't reproduce this report. it's working for me. are you testing minijail as it exists in CrOS today ? that hasn't been rolled yet to include the signal forwarding logic.
what i tested:
- test.c:
int main(int argc, char *argv[])
{
signal(SIGTERM, SIG_IGN);
while (1)
sleep(100);
}
- run `./minijail0 ./a.out &`
- run `kill -TERM %1` and see minijail send SIGTERM to its child process and then go back to waiting (and child ignores it so nothing exits)
- run `kill -INT %1` and see minijail send SIGINT to its child process which now exits, so minijail itself exits
,
Jun 8 2017
I tried reproducing your test but I'm seeing different results: after `kill -TERM %1` minijail terminates, orphaning a.out. I built minijail on my workstation at b9a7b16.
,
Jun 8 2017
you'll need to use 98f4a938cbc4acaff5f06009af50bb4bf19e173b
,
Jun 8 2017
That last commit fixes it. Thanks.
,
Jun 8 2017
I'll tag a new Minijail release at 98f4a938cbc4acaff5f06009af50bb4bf19e173b.
,
Jun 9 2017
,
Jun 21 2018
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by jorgelo@chromium.org
, Jun 7 2017